[Bug tree-optimization/56354] New: [4.8 Regression] -O2 creates incorrect for loop code

orion at cora dot nwra.com gcc-bugzilla@gcc.gnu.org
Sat Feb 16 03:40:00 GMT 2013


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56354

             Bug #: 56354
           Summary: [4.8 Regression] -O2 creates incorrect for loop code
    Classification: Unclassified
           Product: gcc
           Version: 4.8.0
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: tree-optimization
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: orion@cora.nwra.com


Created attachment 29479
  --> http://gcc.gnu.org/bugzilla/attachment.cgi?id=29479
loop.c test case

With the attached program compiled with:

gcc  -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector
--param=ssp-buffer-size=4  -m64 -mtune=generic -fPIC -O1 loop.c

I get the correct output:

Creating arrays...
i=0
i=1
i=2
i=3
i=4
i=5
i=6
i=7
i=8
i=9

But with -O2:

gcc  -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector
--param=ssp-buffer-size=4  -m64 -mtune=generic -fPIC -O2 loop.c

Creating arrays...
i=0
i=1
i=2
i=3
i=4
i=5
i=6
i=7
i=8
i=9
i=10
....
i=55
Segmentation fault

Version-Release number of selected component (if applicable):
gcc-4.8.0-0.12.fc19.x86_64



More information about the Gcc-bugs mailing list