1 // RUN: %clang_cc1 -fsanitize=bounds -emit-llvm -triple x86_64-apple-darwin10 < %s | FileCheck %s
2 
3 // CHECK: @f
4 double f(int b, int i) {
5   double a[b];
6   // CHECK: trap
7   return a[i];
8 }
9 
10 // CHECK: @f2
11 void f2() {
12   // everything is constant; no trap possible
13   // CHECK-NOT: trap
14   int a[2];
15   a[1] = 42;
16 
17   short *b = malloc(64);
18   b[5] = *a + a[1] + 2;
19 }
20 
21 // CHECK: @f3
22 void f3() {
23   int a[1];
24   // CHECK: trap
25   a[2] = 1;
26 }
27