# cat dead.cpp
class Foo
{
public:
  virtual ~Foo();
};

Foo::~Foo()
{
}
# g++ -O2 -S dead.cpp
# cat dead.cpp
...
.globl _ZN3FooD2Ev
        .type   _ZN3FooD2Ev, @function
_ZN3FooD2Ev:
.LFB3:
        pushl   %ebp
.LCFI0: 
        movl    %esp, %ebp
.LCFI1: 
        movl    8(%ebp), %eax
        movl    $_ZTV3Foo+8, (%eax)
        popl    %ebp
        ret
.LFE3:  
        .size   _ZN3FooD2Ev, .-_ZN3FooD2Ev
...


In this trivial case (which is actually quite common),
there's no need for the store to update the vtable pointer,
since there's nothing to do in this destructor.


-- 
           Summary: Dead code in trivial destructors.
           Product: gcc
           Version: 4.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: middle-end
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: spark at gcc dot gnu dot org


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34949

Reply via email to