| 1 |
extern void exit (int); |
| 2 |
extern void abort (void); |
| 3 |
|
| 4 |
typedef union |
| 5 |
{ |
| 6 |
struct |
| 7 |
{ |
| 8 |
int f1, f2, f3, f4, f5, f6, f7, f8; |
| 9 |
long int f9, f10; |
| 10 |
int f11; |
| 11 |
} f; |
| 12 |
char s[56]; |
| 13 |
long int a; |
| 14 |
} T; |
| 15 |
|
| 16 |
__attribute__((noinline)) |
| 17 |
void |
| 18 |
test (T *t) |
| 19 |
{ |
| 20 |
static int i = 11; |
| 21 |
if (t->f.f1 != i++) |
| 22 |
abort (); |
| 23 |
if (t->f.f2 || t->f.f3 || t->f.f4 || t->f.f5 || t->f.f6 |
| 24 |
|| t->f.f7 || t->f.f8 || t->f.f9 || t->f.f10 || t->f.f11) |
| 25 |
abort (); |
| 26 |
if (i == 20) |
| 27 |
exit (0); |
| 28 |
} |
| 29 |
|
| 30 |
__attribute__((noinline)) |
| 31 |
void |
| 32 |
foo (int i) |
| 33 |
{ |
| 34 |
T t; |
| 35 |
again: |
| 36 |
t = (T) { { ++i, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 } }; |
| 37 |
test (&t); |
| 38 |
goto again; |
| 39 |
} |
| 40 |
|
| 41 |
int |
| 42 |
main (void) |
| 43 |
{ |
| 44 |
T *t1, *t2; |
| 45 |
int cnt = 0; |
| 46 |
t1 = (T *) 0; |
| 47 |
loop: |
| 48 |
t2 = t1; |
| 49 |
t1 = & (T) { .f.f9 = cnt++ }; |
| 50 |
if (cnt < 3) |
| 51 |
goto loop; |
| 52 |
if (t1 != t2 || t1->f.f9 != 2) |
| 53 |
abort (); |
| 54 |
foo (10); |
| 55 |
return 0; |
| 56 |
} |