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 3 4 #include <assert.h> 5 #include <time.h> 6 7 #include <sanitizer/msan_interface.h> 8 main(void)9int 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; 26 } 27