1// RUN: %clangxx_asan -O0 %s -o %t && not %run %t 2>&1 | FileCheck %s
2// RUN: %clangxx_asan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s
3// RUN: %clangxx_asan -O2 %s -o %t && not %run %t 2>&1 | FileCheck %s
4// RUN: %clangxx_asan -O3 %s -o %t && not %run %t 2>&1 | FileCheck %s
5
6// CHECK: AddressSanitizer: global-buffer-overflow
7#include "defines.h"
8int global[10];
9// CHECK: {{#0.*call4}}
10void ATTRIBUTE_NOINLINE call4(int i) { global[i + 10]++; }
11// CHECK: {{#1.*call3}}
12void ATTRIBUTE_NOINLINE call3(int i) { call4(i); }
13// CHECK: {{#2.*call2}}
14void ATTRIBUTE_NOINLINE call2(int i) { call3(i); }
15// CHECK: {{#3.*call1}}
16void ATTRIBUTE_NOINLINE call1(int i) { call2(i); }
17// CHECK: {{#4.*main}}
18int main(int argc, char **argv) {
19 call1(i: argc);
20 return global[0];
21}
22

Provided by KDAB

Privacy Policy
Learn to use CMake with our Intro Training
Find out more

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