------- Comment #1 from carrot at google dot com 2009-06-09 07:35 -------
Created an attachment (id=17969)
--> (http://gcc.gnu.org/bugzilla/attachment.cgi?id=17969&action=view)
simple class with empty virtual destructor
Some tree dump result
1. The tree dump of early stage:
cat test_class.cpp.003t.original
;; Function virtual base::~base() (null)
;; enabled by -tree-original
{
<<cleanup_point <<< Unknown tree: expr_stmt
(void) (((struct base *) this)->_vptr.base = &_ZTV4base + 8) >>>
>>;
}
<D.1756>:;
if ((bool) (__in_chrg & 1))
{
<<cleanup_point <<< Unknown tree: expr_stmt
operator delete ((void *) this) >>>
>>;
}
return this;
2. The tree dump of late stage, the reset of vptr is redundant.
cat test_class.cpp.130t.final_cleanup
;; Function base::~base() (_ZN4baseD2Ev)
base::~base() (struct base * const this)
{
<bb 2>:
this->_vptr.base = &_ZTV4base[2];
return this;
}
;; Function virtual base::~base() (_ZN4baseD1Ev)
virtual base::~base() (struct base * const this)
{
<bb 2>:
this->_vptr.base = &_ZTV4base[2];
return this;
}
;; Function virtual base::~base() (_ZN4baseD0Ev)
virtual base::~base() (struct base * const this)
{
<bb 2>:
this->_vptr.base = &_ZTV4base[2];
operator delete (this);
return this;
}
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40382