[ASan/Win] Add a comment about DCL-using-static vs threads
[blocksruntime.git] / test / msan / no_sanitize_memory.cc
blobc5643816c2812814d6341f9b3cea51e85e1b4c8c
1 // RUN: %clangxx_msan -m64 -O0 %s -o %t && %run %t >%t.out 2>&1
2 // RUN: %clangxx_msan -m64 -O1 %s -o %t && %run %t >%t.out 2>&1
3 // RUN: %clangxx_msan -m64 -O2 %s -o %t && %run %t >%t.out 2>&1
4 // RUN: %clangxx_msan -m64 -O3 %s -o %t && %run %t >%t.out 2>&1
6 // RUN: %clangxx_msan -m64 -O0 %s -o %t -DCHECK_IN_F && %run %t >%t.out 2>&1
7 // RUN: %clangxx_msan -m64 -O1 %s -o %t -DCHECK_IN_F && %run %t >%t.out 2>&1
8 // RUN: %clangxx_msan -m64 -O2 %s -o %t -DCHECK_IN_F && %run %t >%t.out 2>&1
9 // RUN: %clangxx_msan -m64 -O3 %s -o %t -DCHECK_IN_F && %run %t >%t.out 2>&1
11 // Test that (no_sanitize_memory) functions
12 // * don't check shadow values (-DCHECK_IN_F)
13 // * treat all values loaded from memory as fully initialized (-UCHECK_IN_F)
15 #include <stdlib.h>
16 #include <stdio.h>
18 __attribute__((noinline))
19 __attribute__((no_sanitize_memory))
20 int f(void) {
21 int x;
22 int * volatile p = &x;
23 #ifdef CHECK_IN_F
24 if (*p)
25 exit(0);
26 #endif
27 return *p;
30 int main(void) {
31 if (f())
32 exit(0);
33 return 0;