https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81702
Bug ID: 81702 Summary: ICE in gimple_get_virt_method_for_vtable Product: gcc Version: 7.1.1 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: adam at os dot inf.tu-dresden.de Target Milestone: --- Created attachment 41918 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41918&action=edit Code triggering the ICE With the following reduced code I'm getting an ICE in gcc-7 and gcc-8. Only happens with -O2. $ g++ g++ (GCC) 7.1.1 20170803 $ g++ -c -O2 -std=gnu++11 t.i t.i:107:33: internal compiler error: in gimple_get_virt_method_for_vtable, at gimple-fold.c:6442 Resource_factory_t<Foo3, Foo> _x; ^ 0x8c4684 gimple_get_virt_method_for_vtable(long, tree_node*, unsigned long, bool*) ../../gcc/gcc/gimple-fold.c:6442 0x111c8c4 ipa_get_indirect_edge_target_1 ../../gcc/gcc/ipa-cp.c:2411 0x93b054 estimate_edge_devirt_benefit ../../gcc/gcc/ipa-inline-analysis.c:3141 0x93b3cb estimate_edge_size_and_time ../../gcc/gcc/ipa-inline-analysis.c:3182 0x93b3cb estimate_calls_size_and_time ../../gcc/gcc/ipa-inline-analysis.c:3254 0x93b688 estimate_node_size_and_time ../../gcc/gcc/ipa-inline-analysis.c:3352 0x93ce03 do_estimate_edge_size(cgraph_edge*) ../../gcc/gcc/ipa-inline-analysis.c:3910 0x93d07f estimate_edge_size ../../gcc/gcc/ipa-inline.h:297 0x93d07f estimate_edge_growth ../../gcc/gcc/ipa-inline.h:308 0x93d07f do_estimate_growth_1 ../../gcc/gcc/ipa-inline-analysis.c:4030 0x93d0c5 cgraph_node::call_for_symbol_and_aliases(bool (*)(cgraph_node*, void*), void*, bool) ../../gcc/gcc/cgraph.h:3150 0x93d0c5 estimate_growth(cgraph_node*) ../../gcc/gcc/ipa-inline-analysis.c:4044 0x11359e9 inline_small_functions ../../gcc/gcc/ipa-inline.c:1764 0x11359e9 ipa_inline ../../gcc/gcc/ipa-inline.c:2434 0x11359e9 execute ../../gcc/gcc/ipa-inline.c:2845 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See <https://gcc.gnu.org/bugs/> for instructions. Adding code as attachment as reducing it more shows to be tricky.