The following code ICE's the 3.3.1 prerelease with -fnon-call-exceptions and -fgcse. Disabling either of the two flags results in successful compilation. This compiles succeffully with the 3.2.3 release. --------------- #include <vector> using std::vector; struct A { float l() const; A operator - (const A &) const; const A & operator = (float) const; }; struct B { float d(); }; struct C { int i; }; float f(const A& a, B& b) { vector<C> vc; int index = vc[0].i; A aa; float d = (aa - a).l(); if (d > b.d()) aa = 0; return b.d(); } ------------------ > /dept/rnd/vendor/gcc-3.3.1-20030720/bin/g++ -fnon-call-exceptions -fgcse -O -c fnce-gcse.C fnce-gcse.C: In function `float f(const A&, B&)': fnce-gcse.C:27: internal compiler error: in split_edge, at cfgrtl.c:1326 Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://gcc.gnu.org/bugs.html> for instructions. -nick
Created attachment 4467 [details] 3.3.1 prerelease preprocessed source triggering bug
The error happens in commit_on_edge_insertion, which is why I thought for a second that it might be the same bug as PR 11083, but that one is fixed (I double-checked). On the other hand, that as well as this report both ICE in commit_one_edge_insertion when using -fnon-call-exceptions. Eric, you fixed 11083 -- would you mind to take a look at this one, too? It's a regression on 3.3 and 3.4 against 3.2. Here's a slightly smaller testcase (not really, since the include file is still there): --------------------------------- #include <vector> using std::vector; struct C { int i; }; void f() { vector<C> vc; int index = vc[0].i; } ------------------------------ tmp/gg> ../build-gcc/gcc-install/bin/c++ -c x.cc -fgcse -fnon-call-exceptions -O x.cc: In function `void f()': x.cc:12: internal compiler error: in commit_one_edge_insertion, at cfgrtl.c: 1546 Please submit a full bug report, with preprocessed source if appropriate. See <URL:http://gcc.gnu.org/bugs.html> for instructions.
OK, this is as short as I can get it (but that should suffice): ----------------------------- struct A { ~A() throw() { } }; struct B { B(const A& __a) : p(0) { } int* p; }; template<typename> struct V : B { V() : B(A()) { } ~V() {} int & foo(); }; void f() { int index = V<int>().foo(); } ------------------------------ mp/gg> ../build-gcc/gcc-install/bin/c++ -c z.cc -fgcse -fnon-call-exceptions -O z.cc: In function `void f()': z.cc:18: internal compiler error: in commit_one_edge_insertion, at cfgrtl.c: 1546 Please submit a full bug report, W.
The regression in PR 11646 was introduced or exposed with this patch: --- gcc/gcc/ChangeLog --- Sat Jul 12 03:06:01 CEST 2003 Jan Hubicka <jh@suse.cz> Gerald Pfeifer <pfeifer@dbai.tuwien.ac.at> * cgraph.c (cgraph_max_uid): New global variable. (cgraph_node): Set uid field. (create_edge): Keep inline flags consistent. (dump_cgraph): Dump more info. [lots more] The regression hunt took place on i686-pc-linux-gnu using the small test case from comment #3 compiled with "-O -fgcse -fnon-call-exceptions".
The patch which Janias quoted almost did not cause this ICE as 3.3.1 ICE also and that patch went only into the mainline. Also the patch might have cause the rtl to be generated differently which caused the problem but who knows.
Wolfgang, note that your reduced testcases are not valid on the 3.3 branch.
Subject: Re: [3.3/3.4 regression] ICE in commit_one_edge_insertion with -fnon-call-exceptions -fgcse -O > Wolfgang, note that your reduced testcases are not > valid on the 3.3 branch. What do you mean by that? I can compile them. However, I can't reproduce the failure mode any more on neither 3.3 branch nor on mainline. Has this been silently fixed? If so, we should ask Janis to search for the patch to see whether it is fixed or just papered over. W. ------------------------------------------------------------------------- Wolfgang Bangerth email: bangerth@ices.utexas.edu www: http://www.ices.utexas.edu/~bangerth/
They are not valid testcases for the bug on the 3.3 branch, that is they don't trigger the ICE while the original code still does as of today.
Subject: Re: [3.3/3.4 regression] ICE in commit_one_edge_insertion with -fnon-call-exceptions -fgcse -O > They are not valid testcases for the bug on the > 3.3 branch, that is they don't trigger the ICE while the original code > still does as of today. Ouch. So someone will have to do the work again. Unfortunately, I won't have the time to do this in the forseeable future. Let's CC: the bugmasters list... W. ------------------------------------------------------------------------- Wolfgang Bangerth email: bangerth@ices.utexas.edu www: http://www.ices.utexas.edu/~bangerth/
Intermediate step to...
...this one.
Created attachment 4756 [details] Partially reduced testcase
Created attachment 4759 [details] Un-templatized testcase
Fixing.
Subject: Bug 11646 CVSROOT: /cvs/gcc Module name: gcc Changes by: ebotcazou@gcc.gnu.org 2003-09-17 07:11:02 Modified files: gcc : ChangeLog cfgrtl.c toplev.c gcc/testsuite : ChangeLog Added files: gcc/testsuite/g++.dg/opt: cfg3.C Log message: PR optimization/11646 * cfgrtl.c (purge_dead_edges) [JUMP_INSN]: Rematerialize the EDGE_ABNORMAL flag for EH edges. * toplev.c (rest_of_handle_cse): Delete unreachable blocks if dead edges were purged. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/ChangeLog.diff?cvsroot=gcc&r1=2.1074&r2=2.1075 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cfgrtl.c.diff?cvsroot=gcc&r1=1.97&r2=1.98 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/toplev.c.diff?cvsroot=gcc&r1=1.825&r2=1.826 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.3059&r2=1.3060 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/opt/cfg3.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
Subject: Bug 11646 CVSROOT: /cvs/gcc Module name: gcc Branch: gcc-3_3-branch Changes by: ebotcazou@gcc.gnu.org 2003-09-17 07:17:18 Modified files: gcc : ChangeLog cfgrtl.c toplev.c gcc/testsuite : ChangeLog Added files: gcc/testsuite/g++.dg/opt: cfg3.C Log message: PR optimization/11646 * cfgrtl.c (purge_dead_edges) [JUMP_INSN]: Rematerialize the EDGE_ABNORMAL flag for EH edges. * toplev.c (rest_of_compilation): Delete unreachable blocks if dead edges were purged after the first CSE pass. 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.739&r2=1.16114.2.740 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cfgrtl.c.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.61.2.11&r2=1.61.2.12 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/toplev.c.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.690.2.21&r2=1.690.2.22 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.280&r2=1.2261.2.281 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/opt/cfg3.C.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=NONE&r2=1.1.2.1
See http://gcc.gnu.org/ml/gcc-patches/2003-09/msg01007.html