comparison gcc/testsuite/gcc.dg/Wstrict-aliasing-float-ptr-int-obj.c @ 111:04ced10e8804

gcc 7
author kono
date Fri, 27 Oct 2017 22:46:09 +0900
parents
children
comparison
equal deleted inserted replaced
68:561a7518be6b 111:04ced10e8804
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-message "initialized" "" { xfail *-*-* } } */
15 } else {
16 q = (float*) &y; /* { dg-message "initialized" "" { xfail *-*-* } } */
17 }
18
19 *q = 1.0; /* { dg-warning "does break strict-aliasing" "" { xfail *-*-* } } */
20
21 return x;
22
23 }