Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / compiler-rt / test / msan / getaddrinfo.cpp
blobc9dcf3ecbae5301c61d92e56bf58fd047214b90b
1 // RUN: %clangxx_msan -O0 %s -o %t && %run %t
3 #include <sys/types.h>
4 #include <sys/socket.h>
5 #include <netdb.h>
6 #include <stdlib.h>
8 void poison_stack_ahead() {
9 char buf[100000];
10 // With -O0 this poisons a large chunk of stack.
13 int main(void) {
14 poison_stack_ahead();
16 struct addrinfo *ai;
18 // This should trigger loading of libnss_dns and friends.
19 // Those libraries are typically uninstrumented.They will call strlen() on a
20 // stack-allocated buffer, which is very likely to be poisoned. Test that we
21 // don't report this as an UMR.
22 int res = getaddrinfo("not-in-etc-hosts", NULL, NULL, &ai);
23 return 0;