http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60871
Bug ID: 60871 Summary: internal compiler error: in possible_polymorphic_call_targets, at ipa-devirt.c:1510 Product: gcc Version: 4.9.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization Assignee: unassigned at gcc dot gnu.org Reporter: holger.hopp at sap dot com Following code throws an internal compiler error with g++-4.9 -O2 $ g++ -O2 -c tst.c tst.c: In static member function ‘static void C11::comp()’: tst.c:88:1: internal compiler error: in possible_polymorphic_call_targets, at ipa-devirt.c:1510 } ^ 0x9e77a8 possible_polymorphic_call_targets(tree_node*, long, ipa_polymorphic_call_context, bool*, void**, int*) ../../gcc/ipa-devirt.c:1510 0x9a3b67 possible_polymorphic_call_targets(tree_node*, bool*, void**) ../../gcc/ipa-utils.h:142 0x9a0d56 gimple_fold_call ../../gcc/gimple-fold.c:1126 0x9a0d56 fold_stmt_1 ../../gcc/gimple-fold.c:1239 0xbbc5b9 fold_marked_statements ../../gcc/tree-inline.c:4541 0xbc9b54 optimize_inline_calls(tree_node*) ../../gcc/tree-inline.c:4622 0x10639b9 early_inliner ../../gcc/ipa-inline.c:2303 0x10639b9 execute ../../gcc/ipa-inline.c:2366 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. Source: void *vptr; class C2 { public: static inline C2 * cbss() { singleton = (C2 *)vptr; return singleton; } private: static C2 * singleton; }; class C3 { public: C3(void) {} virtual void sf(); protected: unsigned m_local:1; }; class C4 : virtual public C3 { public: C4(void) : C3() {} protected: void sf() { } void uf() { } }; class C5 { private: C3 * m_g; public: C5(C3 * g) : m_g(g) { m_g->sf(); } }; class C6 { public: virtual ~C6() {} }; class C7 : public C6 { protected: C7(void) {} }; class C8 : public C4, public C7 { public: C8(void) : C3(), C4(), C7() { } }; class C9 : public C8 { public: C9(void) : C3(), C8() { } }; class C10 : public C9 { protected: C10(void) : C3(), C9() { } }; class C11 : public C10 { protected: C11( const C2 * s ) : C3(), C10() { } public: static void comp(void) { C11 a(C2::cbss()); C5 uf(&a); } }; void foo (void) { C11::comp(); }