gcc/testsuite/gcc.c-torture/execute/950809-1.c
raw| 1 | void abort (void); |
| 2 | void exit (int); |
| 3 | |
| 4 | struct S |
| 5 | { |
| 6 | int *sp, fc, *sc, a[2]; |
| 7 | }; |
| 8 | |
| 9 | void |
| 10 | f (struct S *x) |
| 11 | { |
| 12 | int *t = x->sc; |
| 13 | int t1 = t[0]; |
| 14 | int t2 = t[1]; |
| 15 | int t3 = t[2]; |
| 16 | int a0 = x->a[0]; |
| 17 | int a1 = x->a[1]; |
| 18 | t[2] = t1; |
| 19 | t[0] = a1; |
| 20 | x->a[1] = a0; |
| 21 | x->a[0] = t3; |
| 22 | x->fc = t2; |
| 23 | x->sp = t; |
| 24 | } |
| 25 | |
| 26 | int |
| 27 | main (void) |
| 28 | { |
| 29 | struct S s; |
| 30 | static int sc[3] = {2, 3, 4}; |
| 31 | s.sc = sc; |
| 32 | s.a[0] = 10; |
| 33 | s.a[1] = 11; |
| 34 | f (&s); |
| 35 | if (s.sp[2] != 2) |
| 36 | abort (); |
| 37 | exit (0); |
| 38 | } |