Revert "[lldb][test] Remove compiler version check and use regex" (#124101)
[llvm-project.git] / compiler-rt / test / asan / TestCases / heap-overflow-large.cpp
blob566b1158a5da89d42ea2a977effed010246b3667
1 // Regression test for
2 // https://code.google.com/p/address-sanitizer/issues/detail?id=183
4 // RUN: %clangxx_asan -O2 %s -o %t
5 // RUN: not %run %t 12 2>&1 | FileCheck %s
6 // RUN: not %run %t 100 2>&1 | FileCheck %s
7 // RUN: not %run %t 10000 2>&1 | FileCheck %s
9 #include <stdlib.h>
10 #include <string.h>
11 #include <stdio.h>
13 int main(int argc, char *argv[]) {
14 fprintf(stderr, "main\n");
15 int *x = new int[5];
16 memset(x, 0, sizeof(x[0]) * 5);
17 int index = atoi(argv[1]);
18 unsigned res = x[index];
19 // CHECK: main
20 // CHECK-NOT: CHECK failed
21 delete[] x;
22 return (res % 10) + 1;