1 /* { dg-do run } */ 2 /* { dg-options "-O3 -fno-strict-aliasing" } */ 3 4 struct s { int x; } __attribute__((packed)); 5 struct t { int x; }; 6 7 void __attribute__((noinline,noipa)) swap(struct s * p,struct t * q)8swap(struct s* p, struct t* q) 9 { 10 p->x = q->x; 11 q->x = p->x; 12 } 13 main()14int 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 } 24