diff options
Diffstat (limited to 'gcc/testsuite/gcc.dg/tree-ssa/pr91091-1.c')
-rw-r--r-- | gcc/testsuite/gcc.dg/tree-ssa/pr91091-1.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/tree-ssa/pr91091-1.c b/gcc/testsuite/gcc.dg/tree-ssa/pr91091-1.c new file mode 100644 index 00000000000..2ee75d9804a --- /dev/null +++ b/gcc/testsuite/gcc.dg/tree-ssa/pr91091-1.c @@ -0,0 +1,23 @@ +/* { dg-do run } */ +/* { dg-options "-O3 -fno-strict-aliasing" } */ + +struct s { int x; } __attribute__((packed)); +struct t { int x; }; + +void __attribute__((noinline,noipa)) +swap(struct s* p, struct t* q) +{ + p->x = q->x; + q->x = p->x; +} + +int main() +{ + struct t a[2]; + a[0].x = 0x12345678; + a[1].x = 0x98765432; + swap ((struct s *)((char *)a + 1), a); + if (a[0].x != 0x12345678) + __builtin_abort (); + return 0; +} |