diff --git a/compiler-rt/test/asan/TestCases/heap-overflow-large.cpp b/compiler-rt/test/asan/TestCases/heap-overflow-large.cpp index 566b1158a5da..244417904a75 100644 --- a/compiler-rt/test/asan/TestCases/heap-overflow-large.cpp +++ b/compiler-rt/test/asan/TestCases/heap-overflow-large.cpp @@ -1,10 +1,13 @@ // Regression test for // https://code.google.com/p/address-sanitizer/issues/detail?id=183 -// RUN: %clangxx_asan -O2 %s -o %t -// RUN: not %run %t 12 2>&1 | FileCheck %s -// RUN: not %run %t 100 2>&1 | FileCheck %s -// RUN: not %run %t 10000 2>&1 | FileCheck %s +// RUN: %clangxx_asan -DOFFSET=12 -O2 %s -o %t && not %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_asan -DOFFSET=1000 -O2 %s -o %t && not %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_asan -DOFFSET=100000 -O2 %s -o %t && not %run %t 2>&1 | FileCheck %s + +// RUN: %clangxx_asan -cheerp-linear-output=asmjs -DOFFSET=12 -O2 %s -o %t && not %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_asan -cheerp-linear-output=asmjs -DOFFSET=1000 -O2 %s -o %t && not %run %t 2>&1 | FileCheck %s +// RUN: %clangxx_asan -cheerp-linear-output=asmjs -DOFFSET=100000 -O2 %s -o %t && not %run %t 2>&1 | FileCheck %s #include #include @@ -14,8 +17,7 @@ int main(int argc, char *argv[]) { fprintf(stderr, "main\n"); int *x = new int[5]; memset(x, 0, sizeof(x[0]) * 5); - int index = atoi(argv[1]); - unsigned res = x[index]; + unsigned res = x[OFFSET]; // CHECK: main // CHECK-NOT: CHECK failed delete[] x;