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: unassig...@gcc.gnu.org
        ReportedBy: pl...@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.

Reply via email to