blob: d85f5198650d116354cb16c895a5035dbe074b64 [file] [log] [blame]
Eric Christopher3883e662011-07-26 22:17:02 +00001// RUN: %clang_cc1 %s -emit-llvm -o -
2
3// This tests all kinds of hard cases with initializers and
4// array subscripts. This corresponds to PR487.
5
6struct X { int a[2]; };
7
8int test() {
9 static int i23 = (int) &(((struct X *)0)->a[1]);
10 return i23;
11}
12
13int i = (int) &( ((struct X *)0) -> a[1]);
14
15int Arr[100];
16
17int foo(int i) { return bar(&Arr[49])+bar(&Arr[i]); }
18int foo2(int i) {
19 static const int *X = &Arr[49];
20 static int i23 = (int) &( ((struct X *)0) -> a[0]);
21 int *P = Arr;
22 ++P;
23 return bar(Arr+i);
24}