[ASan/Win] Add a comment about DCL-using-static vs threads
[blocksruntime.git] / test / msan / mktime.cc
blobc419057c3907916f054b1e28a6ec64d3b2c99977
1 // RUN: %clangxx_msan -m64 -O0 -g %s -o %t && %run %t
2 // RUN: %clangxx_msan -m64 -O0 -g -DUNINIT %s -o %t && not %run %t 2>&1 | FileCheck %s
4 #include <assert.h>
5 #include <time.h>
7 #include <sanitizer/msan_interface.h>
9 int main(void) {
10 struct tm tm;
11 tm.tm_year = 2014;
12 tm.tm_mon = 3;
13 tm.tm_mday = 28;
14 #ifndef UNINIT
15 tm.tm_hour = 13;
16 #endif
17 tm.tm_min = 4;
18 tm.tm_sec = 42;
19 tm.tm_isdst = -1;
20 time_t t = mktime(&tm);
21 // CHECK: MemorySanitizer: use-of-uninitialized-value
22 // CHECK: in main{{.*}}mktime.cc:[[@LINE-2]]
23 assert(t != -1);
24 assert(__msan_test_shadow(&tm, sizeof(tm)) == -1);
25 return 0;