Debian Codegraph @

gcc/testsuite/g++.dg/warn/Wstrict-aliasing-float-ref-int-obj.C

raw
1 /* { dg-do compile } */
2 /* { dg-options "-O2 -Wstrict-aliasing -fstrict-aliasing" } */
3
4
5 int foo() {
6 int x;
7 float& q = reinterpret_cast<float&> (x); /* { dg-message "dereferencing type-punned" "deref" } */
8 /* { dg-message "initialized" "note" { xfail *-*-* } .-1 } */
9
10 q = 1.0; /* { dg-warning "does break strict-aliasing" "strict-aliasing" { xfail *-*-* } } */
11 return x;
12 }