NewSigma wrote:

> I don't understand the title and the cited issue. The cited issue is about 
> the point of GRO. How does that relates to the lifetime of promise?

In the cited issue, the GRO conversion function reads coro promise. However, 
since control has flowed off final_suspend, the promise has already been 
destroyed. We will encounter a heap-use-after-free at -O0. This patch defers 
the destruction after GRO conversion, thereby extending the lifetime of the 
promise.

> IIUC, if there is problem, we need to promote the point of GRO.

I thought it is more natural to promote the point of GRO and tried it 
yesterday. But it appears tricky to properly place GRO. On one side, `coro.end` 
must dominate GRO and `ret` so that ramp function and resume function have 
different return types. On the other side, `coro.end` must not dominate 
`coro.cleanup`, which would prevent ramp function and resume function from 
sharing it.

https://github.com/llvm/llvm-project/pull/151067
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to