diff options
Diffstat (limited to 'gcc/testsuite/g++.dg/warn/Wstrict-aliasing-bogus-struct-included.C')
-rw-r--r-- | gcc/testsuite/g++.dg/warn/Wstrict-aliasing-bogus-struct-included.C | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/gcc/testsuite/g++.dg/warn/Wstrict-aliasing-bogus-struct-included.C b/gcc/testsuite/g++.dg/warn/Wstrict-aliasing-bogus-struct-included.C new file mode 100644 index 000000000..3f55c78c9 --- /dev/null +++ b/gcc/testsuite/g++.dg/warn/Wstrict-aliasing-bogus-struct-included.C @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -Wstrict-aliasing -fstrict-aliasing" } */ + + +struct S { + int i; + float f; +}; + +int foo () { + struct S s; + s.i = 7; + float* f = &s.f; /* { dg-bogus "float included in struct S" } */ + *f = 2.0; + return s.i + (int)s.f; +} |