------- Comment #4 from rwgk at yahoo dot com 2008-12-07 07:44 ------- Testing with: g++ (GCC) 4.4.0 20081206 (experimental) svn revision 142514
pr37922repro1.cpp should always exit with status 0. However, it fails this test when compiling with -O3 and -O2: g++ -Wall -fPIC -O3 pr37922repro1.cpp ./a.out ; echo $status 2 g++ -Wall -fPIC -O2 pr37922repro1.cpp ./a.out ; echo $status 2 g++ -Wall -fPIC -O1 pr37922repro1.cpp ./a.out ; echo $status 0 g++ -Wall -fPIC -O0 pr37922repro1.cpp ./a.out ; echo $status 0 The -fPIC is critical. The problem region in the reproducer is marked with comments: // THE PROBLEM IS AROUND HERE if (proper_order < 0) { proper_order *= -1; proper_r = -proper_r; // THIS FAILS ... } if (proper_order > 1) { rot_mx rmi = proper_r.minus_unit_mx(); // ... THEREFORE WRONG HERE Sorry it is still 556 lines long, but I already spent 2 1/2 hours reducing it this far. At least, it is completely self-contained and compiles in fractions of a second. -- http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37922