| 1 |
/* PR c/51628. */ |
| 2 |
/* { dg-do compile } */ |
| 3 |
/* { dg-options "-O" } */ |
| 4 |
|
| 5 |
struct A { __complex int i; }; |
| 6 |
struct B { struct A a; }; |
| 7 |
struct C { struct B b __attribute__ ((packed)); }; |
| 8 |
/* { dg-warning "attribute ignored" "" { target default_packed } .-1 } */ |
| 9 |
|
| 10 |
extern struct C *p; |
| 11 |
|
| 12 |
int* |
| 13 |
foo1 (void) |
| 14 |
{ |
| 15 |
return &__real(p->b.a.i); |
| 16 |
/* { dg-warning "may result in an unaligned pointer value" "" { target { ! default_packed } } .-1 } */ |
| 17 |
} |
| 18 |
|
| 19 |
int* |
| 20 |
foo2 (void) |
| 21 |
{ |
| 22 |
return &__imag(p->b.a.i); |
| 23 |
/* { dg-warning "may result in an unaligned pointer value" "" { target { ! default_packed } } .-1 } */ |
| 24 |
} |