https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70143
Bug ID: 70143 Summary: [6 Regression?] false strict-aliasing warning Product: gcc Version: 6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: jan.kratochvil at redhat dot com Target Milestone: --- struct a { int i; }; struct b { struct a a; int j; }; int main(void) { static struct b b; struct a *ap=(struct a *)&b; return ((struct b *)&ap->i)->j; } ------------------------------------------------------------------------------- -Wall -O2 aliasing.c: In function ‘main’: aliasing.c:11:19: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing] return ((struct b *)&ap->i)->j; ^ FAIL: gcc (GCC) 6.0.0 20160308 (experimental) gcc-6.0.0-0.15.fc24 gcc-6.0.0-0.15.fc25 PASS: gcc-6.0.0-0.14.fc24 gcc-5.3.1-2.fc23.x86_64 Pedro Alves said it is a GCC Bug so I am filing it here. https://sourceware.org/ml/binutils/2016-03/msg00120.html