Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / compiler-rt / test / asan / TestCases / global-underflow.cpp
blob32b4ce82f9b04d31bacb331dc5e243ec9414d1f6
1 // RUN: %clangxx_asan -O0 %s %p/Helpers/underflow.cpp -o %t && not %run %t 2>&1 | FileCheck %s
2 // RUN: %clangxx_asan -O1 %s %p/Helpers/underflow.cpp -o %t && not %run %t 2>&1 | FileCheck %s
3 // RUN: %clangxx_asan -O2 %s %p/Helpers/underflow.cpp -o %t && not %run %t 2>&1 | FileCheck %s
4 // RUN: %clangxx_asan -O3 %s %p/Helpers/underflow.cpp -o %t && not %run %t 2>&1 | FileCheck %s
6 int XXX[2] = {2, 3};
7 extern int YYY[];
8 #include <string.h>
9 int main(int argc, char **argv) {
10 memset(XXX, 0, 2*sizeof(int));
11 // CHECK: {{READ of size 4 at 0x.* thread T0}}
12 // CHECK: {{ #0 0x.* in main .*global-underflow.cpp:}}[[@LINE+3]]
13 // CHECK: {{0x.* is located 4 bytes before global variable}}
14 // CHECK: {{.*YYY.* of size 12}}
15 int res = YYY[-1];
16 return res;