gcc/testsuite/gcc.dg/pr51628-18.c
raw| 1 | /* PR c/51628. */ |
| 2 | /* { dg-do compile } */ |
| 3 | /* { dg-options "-O" } */ |
| 4 | |
| 5 | void foo (int *); |
| 6 | |
| 7 | int * |
| 8 | bar (int n, int k, void *ptr) |
| 9 | { |
| 10 | struct A |
| 11 | { |
| 12 | int c[k]; |
| 13 | int x[n]; |
| 14 | } __attribute__ ((packed, aligned (4))); |
| 15 | struct A *p = (struct A *) ptr; |
| 16 | |
| 17 | int *p0, *p1; |
| 18 | p0 = p->x; |
| 19 | foo (p0); |
| 20 | p1 = &p->x[1]; |
| 21 | foo (p1); |
| 22 | return &p->x[1]; |
| 23 | } |