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 c++/14233] New: SEGFAULT with -O3 -ffast-math


Under Mac OS 10.3.2 some Boost.Python applications compiled with -O3
-ffast-math fail at runtime. The same code works if compiled with -O0.

g++ (GCC) 3.4.0 20040220 (prerelease)

Configured with: /net/worm/scratch1/rwgk/gcc-3_4-branch/configure --
prefix=/usr/local_cci/gcc-3_4-branch_2004_02_20 --enable-languages=c,c++

Apple G5 under OS 10.3.2:
Darwin coral.lbl.gov 6.8 Darwin Kernel Version 6.8: Wed Sep 10 15:20:55
PDT 2003; root:xnu/xnu-344.49.obj~2/RELEASE_PPC  Power Macintosh powerpc

To reproduce the bug get this completely self-contained package:

   http://cci.lbl.gov/~rwgk/bugs/gcc340/gcc340_mac_20040220.tar.gz

To unpack and see the complete information about the source code:

  gunzip -c gcc340_mac_20040220.tar.gz | tar xf -
  cd gcc340_mac_20040220
  more SOURCE_CODE_INFO

It is assumed that g++ == gcc 3.4.0.

The first demonstration compiles with -O0:

  ./demo_optimizer_problem_1.csh

The output should end with:

g++ -w -bundle -
bundle_loader /System/Library/Frameworks/Python.framework/Versions/2.3/Python /S
ystem/Library/Frameworks/Python.framework/Versions/2.3/Python -o 
libtbx/boost_rational_ext.so boost_adaptbx/rational_ext.os -Llibtbx -
L/net_scarlet/scratch1/rwgk/gcc340_mac/libtbx -lboost_python -lm
scons: done building targets.
python ../boost_adaptbx/tst_rational.py
OK

To show the failure when compiling with -O3 -ffast-math:

  ./demo_optimizer_problem_2.csh

The output should end with:

g++ -w -bundle -
bundle_loader /System/Library/Frameworks/Python.framework/Versions/2.3/Python /S
ystem/Library/Frameworks/Python.framework/Versions/2.3/Python -o 
libtbx/boost_rational_ext.so boost_adaptbx/rational_ext.os -Llibtbx -
L/net_scarlet/scratch1/rwgk/gcc340_mac/libtbx -lboost_python -lm
scons: done building targets.
python ../boost_adaptbx/tst_rational.py
Segmentation fault

The same source code works fine with gcc 3.4.0 20040220 under Linux
and many other compilers, including Apple's Xcode 1.1.

Sorry for the big package, but it would be impractical for me to work
out a smaller example. It took several hours already to prepare the set
of reports I am submitting today. I hope you have tools that make it
much easier to pin-point the root of the problem. When you run the demo
the output shows all commands used. You can copy-and-paste the commands
to run them without the build system. If you look at the .csh scripts:
"libtbx.scons" is a replacement for "make". The rest should be obvious
I hope.

-- 
           Summary: SEGFAULT with -O3 -ffast-math
           Product: gcc
           Version: 3.4.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: rwgk at yahoo dot com
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: powerpc-apple-darwin7.2.0
  GCC host triplet: powerpc-apple-darwin7.2.0
GCC target triplet: powerpc-apple-darwin7.2.0


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


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