1673dc3d4SNico Weber // RUN: %clangxx_asan -O3 %s -o %t && %run %t 2673dc3d4SNico Weber 3673dc3d4SNico Weber // Test that no_sanitize_address attribute applies even when the function would 4673dc3d4SNico Weber // be normally inlined. 5673dc3d4SNico Weber 6673dc3d4SNico Weber #include <stdlib.h> 7673dc3d4SNico Weber 8673dc3d4SNico Weber __attribute__((no_sanitize_address)) f(int * p)9673dc3d4SNico Weberint f(int *p) { 10673dc3d4SNico Weber return *p; // BOOOM?? Nope! 11673dc3d4SNico Weber } 12673dc3d4SNico Weber main(int argc,char ** argv)13673dc3d4SNico Weberint main(int argc, char **argv) { 14673dc3d4SNico Weber int * volatile x = (int*)malloc(2*sizeof(int) + 2); 15673dc3d4SNico Weber int res = f(x + 2); 16*5fe1e55dSKamil Rytarowski free(x); 17673dc3d4SNico Weber if (res) 18673dc3d4SNico Weber exit(0); 19673dc3d4SNico Weber return 0; 20673dc3d4SNico Weber } 21