Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Output of gcc -fdump-tree-original

If I dump the code generated by GCC for a virtual destructor (with -fdump-tree-original), I get something like this:

;; Function virtual Foo::~Foo() (null)
;; enabled by -tree-original

{
  <<cleanup_point <<< Unknown tree: expr_stmt
  (void) (((struct Foo *) this)->_vptr.Foo = &_ZTV3Foo + 8) >>>
>>;
}
<D.20148>:;
if ((bool) (__in_chrg & 1))
  {
    <<cleanup_point <<< Unknown tree: expr_stmt
  operator delete ((void *) this) >>>
>>;
  }

My question is: where is the code after "<D.20148>:;" located? It is outside of the destructor so when is this code executed?

like image 424
mtvec Avatar asked Apr 21 '10 17:04

mtvec


1 Answers

That looks like the compiler-generated code to manage the actual memory deallocation after the destructor is called and should execute right after your destructor code.

like image 150
Mark B Avatar answered Sep 24 '22 01:09

Mark B