Output gcc -fdump-tree-original

If I discard the code generated by GCC for the 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>:;"? It is outside the destructor, so when does this code execute?

+3
source share
1 answer

This is similar to the code generated by the compiler to control the actual freeing of memory after calling the destructor and should be executed immediately after the destructor code.

+3
source

Source: https://habr.com/ru/post/1742141/


All Articles