gcc/testsuite/gcc.dg/torture/pr52530.c
raw| 1 | /* { dg-do run } */ |
| 2 | |
| 3 | extern void abort (void); |
| 4 | |
| 5 | #if __SIZEOF_INT__ > 2 |
| 6 | struct foo |
| 7 | { |
| 8 | int *f; |
| 9 | int i; |
| 10 | }; |
| 11 | |
| 12 | int baz; |
| 13 | #else |
| 14 | struct foo |
| 15 | { |
| 16 | long *f; |
| 17 | long i; |
| 18 | }; |
| 19 | |
| 20 | long baz; |
| 21 | #endif |
| 22 | |
| 23 | void __attribute__ ((noinline)) |
| 24 | bar (struct foo x) |
| 25 | { |
| 26 | *(x.f) = x.i; |
| 27 | } |
| 28 | |
| 29 | int |
| 30 | main () |
| 31 | { |
| 32 | struct foo x = { &baz, 0xdeadbeef }; |
| 33 | |
| 34 | bar (x); |
| 35 | |
| 36 | if (baz != 0xdeadbeef) |
| 37 | abort (); |
| 38 | |
| 39 | return 0; |
| 40 | } |