The following code triggers an ICE in the 3.3.1 release: /dept/rnd/vendor/gcc-3.3.1-notpatched/bin/g++ -E gcc331_ie.C > gcc331_ie.ii /dept/rnd/vendor/gcc-3.3.1-notpatched/bin/g++ -fnon-call-exceptions -fno-gcse -O2 gcc331_ie.ii -o gcc331_ie gcc331_ie.C: In function `int main(int, const char**)': gcc331_ie.C:39: internal compiler error: in make_label_edge, at cfgbuild.c:238 Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://gcc.gnu.org/bugs.html> for instructions. --------- #include <string> void getArg( int &i, int argc, const char **argv, float &arg0 ) { if ( i < argc ) { arg0 = atof( argv[i++] ); } } int main (int argc, const char **argv) { float val = 0.0; int i = 1; // // Parse the arguments // try { while ( i < argc ) { std::string arg( argv[i++]); if ( arg == "-" ) { int e=0; throw( e ); } else if ( arg == "-op" ) { getArg( i, argc, argv, val ); } } } catch (...) { } return 0; } ----- It compiles with 3.2.3. It also compiles if gcse is enabled, but bug 11646 is keeping us from doing that with the rest of the code :/ -nick
Created attachment 4719 [details] bzip2 compressed preprocessed test case for pr 12215
*** Bug 12214 has been marked as a duplicate of this bug. ***
Confirmed. A regression on 3.3 branch only. W.
This one was fairly painless compared to some of the optimization PRs: --------------------------- struct B { ~B() throw() {} }; struct X { X(const char*, const B&); ~X() {} }; bool m(); void f(int &i, float &arg0); void g (const char **argv) { float val; int i = 1; try { while ( i < 1 ) { X arg(argv[i], B()); if (m()) throw(0); f(i, val); } } catch (...) {} } ------------------------------------ It only fails with 3.3, but that doesn't mean that the bug is not also present in latent form on mainline, of course: g/x> /home/bangerth/bin/gcc-3.3.2-pre/bin/c++ -fnon-call-exceptions -fno-gcse -O2 -c y.cc y.cc: In function `void g(const char**)': y.cc:27: internal compiler error: in make_label_edge, at cfgbuild.c:238 Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://gcc.gnu.org/bugs.html> for instructions. W.
Related to PR opt/11083. Investigating.
Patch: http://gcc.gnu.org/ml/gcc-patches/2003-09/msg00809.html Erratum: http://gcc.gnu.org/ml/gcc-patches/2003-09/msg00936.html
Subject: Re: [3.3 regression] ICE in make_label_edge with -fnon-call-exceptions -fno-gcse -O2 On Fri, 2003-10-03 at 23:17, ebotcazou at gcc dot gnu dot org wrote: > PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org. > > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12215 Let's call the possibly-trapping insn I. Let's call the next nonnote insn after I N. This patch changes the compiler to emit the new instruction (X) right before N, rather than right after I. Now, N and I are in different basic blocks. So, X will be executed any time control enters the block containing N, even if not falling through from I. Won't that be wrong? Thanks,
No, because I think we are guaranteed that the control flow can't enter block(N) without falling through from block(I) by cse_set_around_loop, because we are guaranteed there is no label between them: /* Look for an insn in front of LOOP_START that sets something in the desired mode to SET_SRC (x) before we hit a label or CALL_INSN. */ for (p = prev_nonnote_insn (loop_start); p && GET_CODE (p) != CALL_INSN && GET_CODE (p) != CODE_LABEL; p = prev_nonnote_insn (p)) [sorry, I should have mentioned it in my first message].
Subject: Re: [3.3 regression] ICE in make_label_edge with -fnon-call-exceptions -fno-gcse -O2 On Mon, 2003-10-06 at 00:20, ebotcazou at gcc dot gnu dot org wrote: > PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org. > > http://gcc.gnu.org/bugzilla/show_bug.cgi?id=12215 OK, it sounds like you've thought this through carefully, and your explanation makes sense. Your patch is OK, then. Thanks,
Subject: Bug 12215 CVSROOT: /cvs/gcc Module name: gcc Changes by: ebotcazou@gcc.gnu.org 2003-10-06 09:18:01 Modified files: gcc : ChangeLog cse.c gcc/testsuite : ChangeLog Added files: gcc/testsuite/g++.dg/opt: cfg2.C Log message: PR optimization/12215 * cse.c (cse_set_around_loop): Emit the move at the beginning of the next basic block for trapping sets. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.1297&r2=2.1298 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cse.c.diff?cvsroot=gcc&r1=1.271&r2=1.272 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.3097&r2=1.3098 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/opt/cfg2.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
Subject: Bug 12215 CVSROOT: /cvs/gcc Module name: gcc Branch: gcc-3_3-branch Changes by: ebotcazou@gcc.gnu.org 2003-10-06 09:24:18 Modified files: gcc : ChangeLog cse.c gcc/testsuite : ChangeLog Added files: gcc/testsuite/g++.dg/opt: cfg2.C Log message: PR optimization/12215 * cse.c (cse_set_around_loop): Emit the move at the beginning of the next basic block for trapping sets. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.16114.2.772&r2=1.16114.2.773 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cse.c.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.244.2.2&r2=1.244.2.3 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.2261.2.298&r2=1.2261.2.299 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/opt/cfg2.C.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=NONE&r2=1.1.2.1
Original patch applied.