gcc/testsuite/c-c++-common/pr51628-16.c
raw| 1 | /* PR c/51628. */ |
| 2 | /* { dg-do compile } */ |
| 3 | /* { dg-options "-O" } */ |
| 4 | |
| 5 | struct __attribute__ ((packed)) A { int i; }; |
| 6 | struct B { |
| 7 | struct A a; |
| 8 | } b; |
| 9 | |
| 10 | int *p = (int*)&b.a.i; |
| 11 | /* { dg-warning "may result in an unaligned pointer value" "" { target { ! default_packed } } .-1 } */ |
| 12 | int *q = (int*)&b.a; |
| 13 | /* { dg-warning "may result in an unaligned pointer value" "" { target { ! default_packed } } .-1 } */ |