OSDN Git Service

* gcc.dg/cpp/cmdlne-dD-M.c: Fix test for makefile rule and remove
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / gcc.dg / Wstrict-aliasing-float-ptr-int-obj.c
1 /* { dg-do compile } */
2 /* { dg-options "-O -Wstrict-aliasing -fstrict-aliasing" } */
3
4 extern int flag;
5
6 int foo() {
7
8   int x;
9   int y = 9;
10   float* q;
11   float* r;
12
13   if (flag) {
14     q = (float*) &x;  /* { dg-warning "type-punn" } */
15   } else {
16     q = (float*) &y;  /* { dg-warning "type-punn" } */
17   }
18
19   *q = 1.0;
20
21   return x;
22
23 }