xref: /aosp_15_r20/external/compiler-rt/test/msan/inline.cc (revision 7c3d14c8b49c529e04be81a3ce6f5cc23712e4c6)
1 // RUN: %clangxx_msan -O3 %s -o %t && %run %t
2 
3 // Test that no_sanitize_memory attribute applies even when the function would
4 // be normally inlined.
5 
6 #include <stdlib.h>
7 
8 __attribute__((no_sanitize_memory))
f(int * p)9 int f(int *p) {
10   if (*p) // BOOOM?? Nope!
11     exit(0);
12   return 0;
13 }
14 
main(int argc,char ** argv)15 int main(int argc, char **argv) {
16   int x;
17   int * volatile p = &x;
18   int res = f(p);
19   return 0;
20 }
21