[clang] [WinEH] Fix object delete crash (PR #180144)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Mar 23 08:26:48 PDT 2026
GkvJwa wrote:
> To me this looks wrong - if there are multiple exits out of a try region they need to be marked individually. But i guess what you are getting at is that SEH even in the presence of EHa is not connected to C++ unwinding (unlinke try/catch EHa which has a connection through state numbers). In this concrete case we are emitting `llvm.seh.scope.begin` + `llvm.seh.try.end` around the A d'tor in preparation for EHa c++ unwinding even though we don't need it. The reason this is happening is because `EHScopeStack::pushCleanup` does not differentiate between pure SEH and EHa.
>
> So I guess a possible fix could be to not emit the EHa C++ unwind region markers if we have a pure SEH function? But this would probably require a more extensive fix.
>
> Nesting can occur if you simply nest multiple try's. If EHa is actually used for C++ try/catch (not seh), the nesting also directly determines the current state number in the WinEHPrepare pass.
Hi @MuellerMP, could you please review again this when you have time? Let's see if this works.
https://github.com/llvm/llvm-project/pull/180144
More information about the cfe-commits
mailing list