This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/30567] New: -fPIC -O3 optimizer bug (32-bit target only)
- From: "rwgk at yahoo dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 24 Jan 2007 00:08:04 -0000
- Subject: [Bug c++/30567] New: -fPIC -O3 optimizer bug (32-bit target only)
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
Platform:
Fedora Core release 4 (Stentz)
Linux sharptail.lbl.gov 2.6.11-1.1369_FC4smp #1 SMP Thu Jun 2 23:08:39 EDT
2005 i686 i686 i386 GNU/Linux
% g++ -v
Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: /net/rosie/scratch2/rwgk/gcc-4_2-branch/configure
--prefix=/net/cci-filer1/vol1/tmp/rwgk/gcc_4_2-branch_2007_01_22_0959_fc4_i686
--enable-languages=c,c++,fortran
Thread model: posix
gcc version 4.2.0 20070122 (prerelease)
I'll upload a standalone reproducer. Sorry it is not minimal, but it is already
heavily reduced from the original code and has only standard header
dependencies.
To reproduce the problem:
g++ -fPIC -O0 ~/dbg.cpp ; ./a.out
1
g++ -fPIC -O3 ~/dbg.cpp ; ./a.out
0
g++ -fPIC -O3 ~/dbg.cpp -DSCITBX_MAT3_TRACE_SIMPLE ; ./a.out
1
g++ -O3 ~/dbg.cpp ; ./a.out
1
The output should be "1" in all cases.
The error occurs in the rot_mx::type() function near the end of the reproducer.
Inserting std::cout statements in this function makes the error go away.
Therefore I don't know what exactly is going wrong.
By chance I noticed that the SCITBX_MAT3_TRACE_SIMPLE change (see code) also
works around the problem. However, the trace() function always works if called
directly.
I noticed the error the first time on Dec 29, 2006 under 32-bit Fedora 6.
Therefore I believe it is not Fedora 4 or 6 specific, but a general 32-bit
optimizer problem.
The gcc svn versions from Dec 29 and Jan 22 both work flawlessly on a 64-bit
platfrom (Fedora 5).
I hope you can take it from here. Let me know if you need any other
information.
--
Summary: -fPIC -O3 optimizer bug (32-bit target only)
Product: gcc
Version: 4.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: rwgk at yahoo dot com
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=30567