[Bug other/52609] New: -Wstrict-aliasing / missed diagnostics
pluto at agmk dot net
gcc-bugzilla@gcc.gnu.org
Sat Mar 17 12:30:00 GMT 2012
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.
More information about the Gcc-bugs
mailing list