When compiling a C++ file, gcc 4.0.0 and 4.0.1 20050507 prerelease report an internal compiler error: > /gcc-test/bin/g++ ice.cpp -O2 ice.cpp: In constructor 'SomeException::SomeException(const char*, ...)': ice.cpp:21: internal compiler error: in calc_dfs_tree, at dominance.c:376 Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://gcc.gnu.org/bugs.html> for instructions. > /gcc-test/bin/g++ -v Using built-in specs. Target: powerpc-linux Configured with: ../gcc-4.0-20050507/configure --enable-languages=c,c++ -- prefix=/gcc-test --with-gnu-as --with-gnu-ld --with-system-zlib --without- included-gettext --enable-threads=posix --enable-haifa --enable-sjlj-exceptions powerpc-linux Thread model: posix gcc version 4.0.1 20050507 (prerelease) When not using -O2 or when using -O2 -msoft-float, the ICE isn't reported. This points to /* Save FP registers if needed. */ if (DEFAULT_ABI == ABI_V4 && TARGET_HARD_FLOAT && TARGET_FPRS && ! no_rtl && next_cum.fregno <= FP_ARG_V4_MAX_REG) branch in gcc/config/rs6000/rs6000.c whose contents causes the problem (directly or indirectly). I have managed to create a minimal testcase for the problem and will attach it to this report.
Created attachment 8843 [details] The isolated snippet causing the problem I'm including the .cpp file and not the .i file since it doesn't need to be preprocessed.
Confirmed with --enable-sjlj-exceptions build.
Created attachment 9640 [details] cfg dump
Created attachment 9643 [details] testcase that fails on mainline mainline powerpc-linux --enable-sjlj-exceptions gives $ ./g++ -B./ -O0 -S /src/tmp/pr21460.cc -Wall /src/tmp/pr21460.cc: In constructor 'SomeException::SomeException(const char*, ...)': /src/tmp/pr21460.cc:31: error: too many outgoing branch edges from bb 0 /src/tmp/pr21460.cc:31: error: in basic block 0: /src/tmp/pr21460.cc:31: error: flow control insn inside a basic block (jump_insn 10 9 103 0 (set (pc) (if_then_else (ne (reg:CC 69 1) (const_int 0 [0x0])) (label_ref 19) (pc))) -1 (nil) (nil)) /src/tmp/pr21460.cc:31: internal compiler error: in rtl_verify_flow_info_1, at cfgrtl.c:2135 The branch is the one generated by rs6000.c:setup_incoming_varargs.
Huh, the problem is that sjlj exception code is tacked on to the end of basic block 0, instead of the end of the prologue.
Subject: Bug 21460 CVSROOT: /cvs/gcc Module name: gcc Changes by: amodra@gcc.gnu.org 2005-09-06 04:53:54 Modified files: gcc : ChangeLog except.c Log message: PR middle-end/21460 * except.c (sjlj_emit_function_enter): Find the function begin note even when it's not in first basic block. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.9898&r2=2.9899 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/except.c.diff?cvsroot=gcc&r1=1.315&r2=1.316
Subject: Bug 21460 CVSROOT: /cvs/gcc Module name: gcc Branch: gcc-4_0-branch Changes by: amodra@gcc.gnu.org 2005-09-06 08:09:44 Modified files: gcc : ChangeLog except.c Log message: PR middle-end/21460 * except.c (sjlj_emit_function_enter): Find the function begin note even when it's not in first basic block. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=2.7592.2.412&r2=2.7592.2.413 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/except.c.diff?cvsroot=gcc&only_with_tag=gcc-4_0-branch&r1=1.298&r2=1.298.2.1
Fixed
The problem is indeed fixed in 4.0.2, thank you.
This was fixed long ago. Closing.