This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug other/52609] New: -Wstrict-aliasing / missed diagnostics
- From: "pluto at agmk dot net" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Sat, 17 Mar 2012 11:31:42 +0000
- Subject: [Bug other/52609] New: -Wstrict-aliasing / missed diagnostics
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52609
Bug #: 52609
Summary: -Wstrict-aliasing / missed diagnostics
Classification: Unclassified
Product: gcc
Version: 4.8.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: other
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: pluto@agmk.net
Target: x86_64-gnu-linux
void bug1( unsigned* buffer, int index, float w )
{
*(float*)(&buffer[index])=w;
}
void bug2( unsigned* buffer, int index, float w )
{
float* ptr=(float*)&buffer[index];
*ptr=w;
}
accessing unsigned* via float* looks buggy but
$ gcc48 -Wall -Wstrict-aliasing=3 -Wextra -fstrict-aliasing -O2 -S alias-bug.c
reports no warnings.