Merge -r 127928:132243 from trunk
[official-gcc.git] / gcc / testsuite / gcc.c-torture / execute / 20071029-1.c
blob6b895d60a5e336fe2ece03a03a44009a4b888bbc
1 extern void exit (int);
2 extern void abort (void);
4 typedef union
6 struct
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;
16 __attribute__((noinline))
17 void
18 test (T *t)
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);
30 __attribute__((noinline))
31 void
32 foo (int i)
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;
41 int
42 main (void)
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;