I just tried to compile the Suse Factory package blocxx-2.1.0.342-124.7 with the GNU g++ version 4.5 snapshot 20090604. The compiler said SecureRand.cpp: In function 'void<unnamed>::rand_init_impl()': SecureRand.cpp:667:7: internal compiler error: Segmentation fault Please submit a full bug report, with preprocessed source if appropriate. See <http://gcc.gnu.org/bugs.html> for instructions. Preprocessed source code attached. Flag -O2 required. Here is valgrind helping out with a stack backtrace ==8611== Invalid read of size 8 ==8611== at 0x6EE6FF: remove_unreachable_regions (bitmap.h:225) ==8611== Address 0x0 is not stack'd, malloc'd or (recently) free'd This bug seems to be different to # 40163.
Can you attach preprocessed source?
Created attachment 17973 [details] C++ source code
It is caused by revision 146776: http://gcc.gnu.org/ml/gcc-cvs/2009-04/msg01418.html
Confirmed. Reduced testcase (already crashes with "-O"): ====================================== struct A { ~A(); }; struct B { A* p; ~B() { if (p) delete p; delete p; } }; struct C { B* q; ~C() { try { delete q; } catch (...) { } } }; void foo() { C c1, c2; } ======================================
Even shorter testcase: ================== void foo(); struct A { ~A() { try { foo(); foo(); } catch (...) { } } }; void bar() { A a1, a2; } ==================
#1 0x00000000008c8613 in can_be_reached_by_runtime (contains_stmt=0x188ab30, r=0x7ffff5fc33f0) at /space/rguenther/src/svn/trunk/gcc/except.c:569 569 EXECUTE_IF_SET_IN_BITMAP (i->aka, 0, n, bi) (gdb) p i->aka $1 = (bitmap) 0x0
Subject: Re: [4.5 Regression] another null pointer in remove_unreachable_regions > 569 EXECUTE_IF_SET_IN_BITMAP (i->aka, 0, n, bi) > (gdb) p i->aka > $1 = (bitmap) 0x0 oops, forgot about this issue. Testing obvious patch checking for i->aka being NULL.
Fixed.
It doesn't work. On Linux/ia32, I got FAIL: g++.dg/torture/pr40388.C -O0 (test for excess errors) FAIL: g++.dg/torture/pr40388.C -O1 (test for excess errors) FAIL: g++.dg/torture/pr40388.C -O2 (test for excess errors) FAIL: g++.dg/torture/pr40388.C -O3 -fomit-frame-pointer (test for excess errors) FAIL: g++.dg/torture/pr40388.C -O3 -g (test for excess errors) FAIL: g++.dg/torture/pr40388.C -Os (test for excess errors)
The same failure happens on Linux/Intel64 and Linux/ia64.
The testsuite failure was due to a double paste into the testcase; fixing that maxes it work.
Subject: Re: [4.5 Regression] another null pointer in remove_unreachable_regions > The testsuite failure was due to a double paste into the testcase; fixing that > maxes it work. Uh, double application of patch.. Thanks for fixing it!