gcc/testsuite/gcc.dg/tree-ssa/pr91091-1.c
raw| 1 | /* { dg-do run } */ |
| 2 | /* { dg-options "-O3 -fno-strict-aliasing" } */ |
| 3 | |
| 4 | struct s { __INT32_TYPE__ x; } __attribute__((packed)); |
| 5 | struct t { __INT32_TYPE__ x; }; |
| 6 | |
| 7 | void __attribute__((noinline,noipa)) |
| 8 | swap(struct s* p, struct t* q) |
| 9 | { |
| 10 | p->x = q->x; |
| 11 | q->x = p->x; |
| 12 | } |
| 13 | |
| 14 | int main() |
| 15 | { |
| 16 | struct t a[2]; |
| 17 | a[0].x = 0x12345678; |
| 18 | a[1].x = 0x98765432; |
| 19 | swap ((struct s *)((char *)a + 1), a); |
| 20 | if (a[0].x != 0x12345678) |
| 21 | __builtin_abort (); |
| 22 | return 0; |
| 23 | } |