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))
9int f(int *p) {
10 return *p; // BOOOM?? Nope!
11}
12
13int main(int argc, char **argv) {
14 int * volatile x = (int*)malloc(size: 2*sizeof(int) + 2);
15 int res = f(p: x + 2);
16 free(ptr: x);
17 if (res)
18 exit(status: 0);
19 return 0;
20}
21

source code of compiler-rt/test/asan/TestCases/inline.cpp