• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // RUN: %clangxx_asan -O3 %s -o %t && %run %t
2 
3 // Test that no_sanitize_address attribute applies even when the function would
4 // be normally inlined.
5 
6 #include <stdlib.h>
7 
8 __attribute__((no_sanitize_address))
f(int * p)9 int f(int *p) {
10   return *p; // BOOOM?? Nope!
11 }
12 
main(int argc,char ** argv)13 int main(int argc, char **argv) {
14   int * volatile x = (int*)malloc(2*sizeof(int) + 2);
15   int res = f(x + 2);
16   if (res)
17     exit(0);
18   return 0;
19 }
20