the attached program generates wrong code with -O -fstrict-aliasing (-O works),
although -Wstrict-aliasing doesn't issue a warning.
The bug was not present in gcc version 3.3.3 20040412 (Red Hat Linux 3.3.3-7)
(the generated code was OK even with -O3).
The bug is present in :
- gcc version 4.0.1 20050727 (Red Hat 4.0.1-5)
- gcc 4.0.2
- gcc version 4.1.0 20051128 (prerelease) gcc-4_1-branch
gcc version 4.2.0 20051128 (experimental) issues the warning, and generates the
right code with -O2 -fstrict-aliasing, though it breaks with -O3. My conclusion
is that gcc 4.2 doesn't have this bug.
IMHO this is critical, since it's a regression from 3.3, and gcc generates
wrong code without the user being warned.
Fred
--
Summary: -fstrict-aliasing generates wrong code, but no warning
from -Wstrict-aliasing
Product: gcc
Version: 4.1.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: frederic dot devernay at m4x dot org
GCC build triplet: i386-redhat-linux
GCC host triplet: i386-redhat-linux
GCC target triplet: i386-redhat-linux
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25152