gcc -fdump-tree-original 的输出
如果我将 GCC 生成的代码转储为虚拟析构函数(使用 -fdump-tree-original),我会得到这样的结果:
;; 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) >>>
>>;
}
我的问题是: "
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这看起来像是编译器生成的代码,用于在调用析构函数后管理实际的内存释放,并且应该在析构函数代码之后立即执行。
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.