1// Regression test for 2// https://code.google.com/p/address-sanitizer/issues/detail?id=183 3 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 8 9#include <stdlib.h> 10#include <string.h> 11#include <stdio.h> 12 13int 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; 23} 24