| 1 |
// RUN: %clang_cc1 -triple i386-apple-darwin9 -fobjc-runtime=macosx-fragile-10.5 -O3 -emit-llvm -o %t %s |
| 2 |
// RUN: grep 'ret i32 385' %t |
| 3 |
|
| 4 |
void *alloca(unsigned); |
| 5 |
|
| 6 |
@interface I0 { |
| 7 |
@public |
| 8 |
int iv0; |
| 9 |
int iv1; |
| 10 |
int iv2; |
| 11 |
} |
| 12 |
@end |
| 13 |
|
| 14 |
static int f0(I0 *a0) { |
| 15 |
return (*(a0 + 2)).iv0; |
| 16 |
} |
| 17 |
|
| 18 |
static int f1(I0 *a0) { |
| 19 |
return a0[2].iv1; |
| 20 |
} |
| 21 |
|
| 22 |
static int f2(I0 *a0) { |
| 23 |
return (*(a0 - 1)).iv2; |
| 24 |
} |
| 25 |
|
| 26 |
int g0(void) { |
| 27 |
I0 *a = alloca(sizeof(*a) * 4); |
| 28 |
a[2].iv0 = 5; |
| 29 |
a[2].iv1 = 7; |
| 30 |
a[2].iv2 = 11; |
| 31 |
return f0(a) * f1(a) * f2(&a[3]); |
| 32 |
} |
| 33 |
|
| 34 |
|