This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug optimization/11969] New: -foptimize-sibling-calls from -O2 creates bad code


PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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

           Summary: -foptimize-sibling-calls from -O2 creates bad code
           Product: gcc
           Version: 3.2.2
            Status: UNCONFIRMED
          Severity: critical
          Priority: P2
         Component: optimization
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: grhoten at jtcsv dot com
                CC: gcc-bugs at gcc dot gnu dot org

The ICU (International Components for Unicode) project keeps on getting bug 
reports about how ICU won't build with the -O2 or -Os optimization flags. After 
many hours of debugging, I've been able to narrow the problem down.

I have narrowed it down to the -foptimize-sibling-calls option that is included 
with the -O2 and -Os flags. It causes one of our tools to generate an internal 
program error. It seems to affect only one file in ICU 
(icu/source/i18n/ucol_wgt.c). You can see a copy of the file here: 
http://oss.software.ibm.com/cvs/icu/~checkout~/icu/source/i18n/ucol_wgt.c?
only_with_tag=release-2-6

We know it fails with Red Hat Linux 8 and 9 on x86. Other people on Mac OS and 
Solaris have also reported the same problem. At least gcc 3.2, 3.2.2 and 3.3 
fail to properly optimize the code.

To get around this problem we use -O3. I think it includes the -Winline option, 
which seems to be the work around for now. If I declare all of the static 
functions as inline in ucol_wgt.c, the build problem will also disappear.

I'm not exactly sure what the exact problem is in the generated assembly code, 
but the -foptimize-sibling-calls option is the source of the problem. I'm just 
worried that this option causes something else to fail too, and we haven't run 
across is yet.

I know you guys don't like to download projects, but you can download the 
source code for testing from here: 
http://oss.software.ibm.com/icu/download/index.html

ICU 2.6 is known to have this problem, but other previous version are known to 
have it too, like ICU 2.2 and ICU 2.4.

BTW thanks for listing the optimization flags used in the gcc 3.3 
documentation. It helped a lot.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]