[Bug c/50291] New: A bug of if-condition optimization in x32
yahemore at gmail dot com
gcc-bugzilla@gcc.gnu.org
Mon Sep 5 02:15:00 GMT 2011
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50291
Bug #: 50291
Summary: A bug of if-condition optimization in x32
Classification: Unclassified
Product: gcc
Version: 4.7.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: yahemore@gmail.com
Created attachment 25191
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=25191
c example code
Hi,
I use the x32 compiler and encounter a optimization issue.
Attachments are the example code and the results.
Gcc compiler version : 4.7.0 20110817
OS and development environment : gcc version 4.5.2 under Mingw (32-bit), xp sp3
Command : x86_64-unknown-elf-gcc -mx32 -O2 example.c -S
In the example, if we don't comment the line of Fb(...) or Ff(...), we can find
out that compiler skip the result of if-condition in the example.c :
if( cca == 0 && ccb == 0)
{
DataBlkPreAllocated = 1;
}
Because the cca and ccb may be changed by other function, this result is wrong.
If we add the "–fno-if-conversion" option, the compiler wouldn't skip this
if-condition.
But using "–fno-if-conversion" may generate more jump instructions in large
code.
So I guess this problem may be relative to the "–fif-conversion" optimization.
best regards,
More information about the Gcc-bugs
mailing list