http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60429
Bug ID: 60429 Summary: Miscompilation (aliasing) with -finline-functions Product: gcc Version: 4.8.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: libgcc Assignee: unassigned at gcc dot gnu.org Reporter: linux at carewolf dot com After recently trying to build Qt with -O3, I found one of our tests failing. After investigating I narrowed it down to qregion.cpp and the flag -finline-functions (using -O2 -finline-functions). Specificially the inlining of the function loadAET() in "QRegionPrivate *PolygonRegion()" causes the problem. Adding __attribute__((noinline)) to loadAET() solves the problem. Interestingly compiling without -finline-function and just marking the loadAET as inline or always_inline, does not trigger the issue. The code is not Qt specific and is used in a other projects, though it is most places compiled as C code. Further testing shows the issue is also triggered in GCC 4.6, 4.7, and the latest version of 4.9 I had. It is however NOT present in GCC 4.4, so this is a regression. Looking at the assembler and debug output, I believe the that the variable pAET that should have been reloaded after loadAET() has been eliminated. This might be what breaks the aliasing rules.