1// RUN: %clangxx_msan -std=c++11 -O0 -g %s -o %t && not %run %t 2>&1 | FileCheck %s
2// RUN: %clangxx_msan -DLEFT_OK -std=c++11 -O0 -g %s -o %t && not %run %t 2>&1 | FileCheck %s
3// RUN: %clangxx_msan -DRIGHT_OK -std=c++11 -O0 -g %s -o %t && not %run %t 2<&1 | FileCheck %s
4// RUN: %clangxx_msan -DLEFT_OK -DRIGHT_OK -std=c++11 -O0 -g %s -o %t && %run %t
5// REQUIRES: !android
6
7#include <assert.h>
8#include <sanitizer/msan_interface.h>
9#include <signal.h>
10#include <sys/time.h>
11#include <unistd.h>
12
13int main(void) {
14 sigset_t s, t, u;
15#ifdef LEFT_OK
16 sigemptyset(&t);
17#endif
18#ifdef RIGHT_OK
19 sigemptyset(&u);
20#endif
21
22 // CHECK: MemorySanitizer: use-of-uninitialized-value
23 // CHECK-NEXT: in main {{.*}}sigandorset.cpp:[[@LINE+1]]
24 sigandset(set: &s, left: &t, right: &u);
25 sigorset(set: &s, left: &t, right: &u);
26 __msan_check_mem_is_initialized(x: &s, size: sizeof s);
27 return 0;
28}
29

source code of compiler-rt/test/msan/Linux/sigandorset.cpp