2015-03-03 03:34:27 +08:00
|
|
|
// RUN: %clangxx_msan -O0 %s -o %t && not %run %t >%t.out 2>&1
|
2013-05-22 20:50:26 +08:00
|
|
|
// RUN: FileCheck %s < %t.out
|
2015-03-03 03:34:27 +08:00
|
|
|
// RUN: %clangxx_msan -O3 %s -o %t && not %run %t >%t.out 2>&1
|
2013-05-22 20:50:26 +08:00
|
|
|
// RUN: FileCheck %s < %t.out
|
|
|
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/socket.h>
|
|
|
|
#include <netdb.h>
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
2013-05-28 22:34:37 +08:00
|
|
|
volatile int z;
|
|
|
|
|
2013-05-22 20:50:26 +08:00
|
|
|
int main(void) {
|
|
|
|
struct addrinfo *ai;
|
|
|
|
struct addrinfo hint;
|
2013-05-28 22:34:37 +08:00
|
|
|
int res = getaddrinfo("localhost", NULL, NULL, &ai);
|
|
|
|
if (ai) z = 1; // OK
|
|
|
|
res = getaddrinfo("localhost", NULL, &hint, &ai);
|
2014-05-07 19:50:14 +08:00
|
|
|
// CHECK: Uninitialized bytes in __interceptor_getaddrinfo at offset 0 inside [0x{{.*}}, 48)
|
2013-05-28 22:27:30 +08:00
|
|
|
// CHECK: WARNING: MemorySanitizer: use-of-uninitialized-value
|
2013-05-22 20:50:26 +08:00
|
|
|
// CHECK: #0 {{.*}} in main {{.*}}getaddrinfo-positive.cc:[[@LINE-3]]
|
|
|
|
return 0;
|
|
|
|
}
|