Message ID | alpine.LSU.2.11.1603091452560.31547@t29.fhfr.qr |
---|---|
State | New |
Headers | show |
Index: gcc/testsuite/gcc.dg/Wstrict-aliasing-struct-with-char-member.c =================================================================== --- gcc/testsuite/gcc.dg/Wstrict-aliasing-struct-with-char-member.c (revision 0) +++ gcc/testsuite/gcc.dg/Wstrict-aliasing-struct-with-char-member.c (working copy) @@ -0,0 +1,16 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -Wall" } */ + +struct a { + int i; + char c; +}; +struct b { + float f; + float g; +}; +int main(void) +{ + static struct b b; + return ((struct a *)&b)->i; /* { dg-warning "will break strict-aliasing" } */ +}