blob: fa7541f8141e7e0133c2349fca5aaee5172ad616 [file] [log] [blame]
// RUN: %clang_cc1 -fsanitize=bounds -emit-llvm -triple x86_64-apple-darwin10 < %s | FileCheck %s
// CHECK: @f
double f(int b, int i) {
double a[b];
// CHECK: trap
return a[i];
}
// CHECK: @f2
void f2() {
// everything is constant; no trap possible
// CHECK-NOT: trap
int a[2];
a[1] = 42;
short *b = malloc(64);
b[5] = *a + a[1] + 2;
}
// CHECK: @f3
void f3() {
int a[1];
// CHECK: trap
a[2] = 1;
}