Debian Codegraph @

gcc/testsuite/gcc.dg/Wstrict-aliasing-bogus-upcast.c

raw
1 /* { dg-do compile } */
2 /* { dg-options "-O2 -Wall" } */
3
4 struct a {
5 int i;
6 };
7 struct b {
8 struct a a;
9 int j;
10 };
11 int main(void)
12 {
13 static struct b b;
14 struct a *ap=(struct a *)&b;
15 return ((struct b *)&ap->i)->j; /* { dg-bogus "will break strict-aliasing" } */
16 }
17