blob: b90fb76c28bcb98d38a88c57e72914ea4c85e8fb (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
/* { dg-do compile } */
/* { dg-options "-O -Wstrict-aliasing -fstrict-aliasing" } */
extern int flag;
int foo() {
int x;
int y = 9;
float* q;
float* r;
if (flag) {
q = (float*) &x; /* { dg-message "initialized" "" { xfail *-*-* } } */
} else {
q = (float*) &y; /* { dg-message "initialized" "" { xfail *-*-* } } */
}
*q = 1.0; /* { dg-warning "does break strict-aliasing" "" { xfail *-*-* } } */
return x;
}
|