http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45791
Summary: Missed devirtualization Product: gcc Version: 4.6.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: tree-optimization AssignedTo: unassig...@gcc.gnu.org ReportedBy: hubi...@gcc.gnu.org Compiling // PR rtl-optimization/36185 // { dg-do run } // { dg-options "-O2 -fgcse-sm" } struct Base { virtual ~Base() {} virtual void f() = 0; }; struct Derived : Base { Derived(); virtual void f() {} }; struct Foo { Foo(Base&); }; Derived::Derived() { Foo foo(*this); } Foo::Foo(Base& base) { base.f(); } int main() { Derived d; } makes einline to produce: MEM[(struct Base *)&d]._vptr.Base = &_ZTV4Base[2]; d.D.2114._vptr.Base = &_ZTV7Derived[2]; D.2243_5 = &d.D.2114; D.2241_6 = MEM[(struct Base *)&d]._vptr.Base; D.2242_7 = MEM[(int (*__vtbl_ptr_type) (void) *)D.2241_6 + 16B]; OBJ_TYPE_REF(D.2242_7;D.2243_5->2) (D.2243_5); this should get devirtualized but doesn't -- Configure bugmail: http://gcc.gnu.org/bugzilla/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug.