19 lines · cpp
1// XFAIL: msvc2// RUN: %clangxx_asan -O0 %s %p/Helpers/underflow.cpp -o %t && not %run %t 2>&1 | FileCheck %s3// RUN: %clangxx_asan -O1 %s %p/Helpers/underflow.cpp -o %t && not %run %t 2>&1 | FileCheck %s4// RUN: %clangxx_asan -O2 %s %p/Helpers/underflow.cpp -o %t && not %run %t 2>&1 | FileCheck %s5// RUN: %clangxx_asan -O3 %s %p/Helpers/underflow.cpp -o %t && not %run %t 2>&1 | FileCheck %s6 7int XXX[2] = {2, 3};8extern int YYY[];9#include <string.h>10int main(int argc, char **argv) {11 memset(XXX, 0, 2*sizeof(int));12 // CHECK: {{READ of size 4 at 0x.* thread T0}}13 // CHECK: {{ #0 0x.* in main .*global-underflow.cpp:}}[[@LINE+3]]14 // CHECK: {{0x.* is located 4 bytes before global variable}}15 // CHECK: {{.*YYY.* of size 12}}16 int res = YYY[-1];17 return res;18}19