Created attachment 33032 [details] preprocessed source current gcc-4_9-branch, ICE with "-O3". -O2 works; gcc-4.8.3 handles "-O3" fine as well. (source is scummvm-1.6.0/engines/tony/font.cpp) i686-pc-linux-gnu-g++ -O3 -c font.i In file included from ./engines/tony/input.h:32:0, from engines/tony/font.cpp:32: ./common/events.h: In function '<built-in>': ./common/events.h:239:7: internal compiler error: in release_function_body, at cgraph.c:1699 Thanks!
markus@x4 tmp % cat font.ii class A { virtual int m_fn1 (int, int = 0) = 0; int m_fn2 (const int &); int _nPrior; }; class B : virtual A { int _lDefault; int m_fn1 (int, int); }; int A::m_fn2 (const int &) { return m_fn1 ('\0'); } int B::m_fn1 (int, int) { return 0 ?: _lDefault; } markus@x4 tmp % g++ -m32 -c -O3 font.ii font.ii: In function ‘<built-in>’: font.ii:14:50: internal compiler error: in release_function_body, at cgraph.c:1691 int B::m_fn1 (int, int) { return 0 ?: _lDefault; } ^ 0x841577 release_function_body(tree_node*) ../../gcc/gcc/cgraph.c:1691 0x841626 cgraph_release_function_body(cgraph_node*) ../../gcc/gcc/cgraph.c:1727 0x841aa6 cgraph_remove_node(cgraph_node*) ../../gcc/gcc/cgraph.c:1812 0xa1c3eb symtab_remove_unreachable_nodes(bool, _IO_FILE*) ../../gcc/gcc/ipa.c:463 0xace957 execute_todo ../../gcc/gcc/passes.c:1843 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <http://gcc.gnu.org/bugs.html> for instructions.
git blame points to r209892.
Created attachment 33061 [details] gcc410-pr61654.patch Untested fix.
The patch shifted the ICE to the following, same source file: In file included from ./engines/tony/input.h:32:0, from engines/tony/font.cpp:32: ./common/events.h:239:7: internal compiler error: in ipa_propagate_frequency, at ipa-profile.c:411 class DefaultEventMapper : public EventMapper { ^ Please submit a full bug report, with preprocessed source if appropriate. See <https://bugs.gentoo.org/> for instructions. Makefile.common:98: recipe for target 'engines/tony/font.o' failed
Author: jakub Date: Fri Jul 4 08:38:45 2014 New Revision: 212293 URL: https://gcc.gnu.org/viewcvs?rev=212293&root=gcc&view=rev Log: PR middle-end/61654 * cgraphunit.c (expand_thunk): Call free_dominance_info. * g++.dg/opt/pr61654.C: New test. Added: trunk/gcc/testsuite/g++.dg/opt/pr61654.C Modified: trunk/gcc/ChangeLog trunk/gcc/cgraphunit.c trunk/gcc/testsuite/ChangeLog
Author: jakub Date: Fri Jul 4 08:39:31 2014 New Revision: 212294 URL: https://gcc.gnu.org/viewcvs?rev=212294&root=gcc&view=rev Log: PR middle-end/61654 * cgraphunit.c (expand_thunk): Call free_dominance_info. * g++.dg/opt/pr61654.C: New test. Added: branches/gcc-4_9-branch/gcc/testsuite/g++.dg/opt/pr61654.C Modified: branches/gcc-4_9-branch/gcc/ChangeLog branches/gcc-4_9-branch/gcc/cgraphunit.c branches/gcc-4_9-branch/gcc/testsuite/ChangeLog
Reduced testcase for the other ICE, ICEs only with -O3 -m32 and not with -O3 -m64 on x86_64-linux: struct A { virtual int a (int, int = 0); void b (); void c (); int d; }; struct B : virtual A { int a (int, int); int e; }; int f; void A::b () { a (0); } void A::c () { a (f); } int B::a (int, int) { return e; }
The reduced testcase doesn't ICE on the branch, the full preprocessed source does.
Richard mentioned that #c7 doesn't ICE on the 4.9 branch, only trunk. This one ICEs on the 4.9 branch too (the only change is " = 0", i.e. making A::a pure virtual), again -O3 -m32 is needed: struct A { virtual int a (int, int = 0) = 0; void b (); void c (); int d; }; struct B : virtual A { int a (int, int); int e; }; int f; void A::b () { a (0); } void A::c () { a (f); } int B::a (int, int) { return e; }
GCC 4.9.1 has been released.
ipa_propagate_frequency is seeing an artificial_thunk. Mine.
I have proposed a fix on the mailing list: https://gcc.gnu.org/ml/gcc-patches/2014-09/msg00207.html
Author: jamborm Date: Wed Sep 10 11:34:09 2014 New Revision: 215122 URL: https://gcc.gnu.org/viewcvs?rev=215122&root=gcc&view=rev Log: 2014-09-10 Martin Jambor <mjambor@suse.cz> PR ipa/61654 * cgraphclones.c (duplicate_thunk_for_node): Copy arguments of the new decl properly. Analyze the new thunk if it is expanded. gcc/testsuite/ * g++.dg/ipa/pr61654.C: New test. Added: trunk/gcc/testsuite/g++.dg/ipa/pr61654.C Modified: trunk/gcc/ChangeLog trunk/gcc/cgraphclones.c trunk/gcc/testsuite/ChangeLog
Author: jamborm Date: Fri Sep 12 16:52:24 2014 New Revision: 215228 URL: https://gcc.gnu.org/viewcvs?rev=215228&root=gcc&view=rev Log: 2014-09-12 Martin Jambor <mjambor@suse.cz> PR ipa/61654 * cgraph.h (cgraph_analyze_function): Declare. * cgraphunit.c: (analyze_function): Remove forward declaration, rename to cgraph_analyze_function, made external. * cgraphclones.c (duplicate_thunk_for_node): Copy arguments of the new decl properly. Analyze the new thunk if it is expanded. gcc/testsuite/ * g++.dg/ipa/pr61654.C: New test. Added: branches/gcc-4_9-branch/gcc/testsuite/g++.dg/ipa/pr61654.C Modified: branches/gcc-4_9-branch/gcc/ChangeLog branches/gcc-4_9-branch/gcc/cgraph.h branches/gcc-4_9-branch/gcc/cgraphclones.c branches/gcc-4_9-branch/gcc/cgraphunit.c branches/gcc-4_9-branch/gcc/testsuite/ChangeLog
Fixed.