PR middle-end/27945
[official-gcc.git] / gcc / testsuite / gcc.dg / Wstrict-aliasing-float-ptr-int-obj.c
blob7780fa6fcd65e146b82b6ff116d2f57624986b33
1 /* { dg-do compile } */
2 /* { dg-options "-O -Wstrict-aliasing -fstrict-aliasing" } */
4 extern int flag;
6 int foo() {
8 int x;
9 int y = 9;
10 float* q;
11 float* r;
13 if (flag) {
14 q = (float*) &x; /* { dg-warning "type-punn" } */
15 } else {
16 q = (float*) &y; /* { dg-warning "type-punn" } */
19 *q = 1.0;
21 return x;