Skip to content

Handle multiple action records in EH personality function - #160923

Open
nbdd0121 wants to merge 1 commit into
rust-lang:mainfrom
nbdd0121:eh_personality
Open

Handle multiple action records in EH personality function#160923
nbdd0121 wants to merge 1 commit into
rust-lang:mainfrom
nbdd0121:eh_personality

Conversation

@nbdd0121

Copy link
Copy Markdown
Member

LSDA encodes actions are a linked list, we currently only decode the first one. Action records are used for catching specific exception types and for exception specifications, and none of these are present in Rust. However we can still have of multiple of them being present due to LLVM inlining. When this happens, "Catch" is the correct action to execute.

We haven't had issues with this because LLVM orders cleanup record last; however GCC doesn't use the same order, so we do need to explicitly handle this case to support both LLVM and GCC codegen.

See https://rust-lang.zulipchat.com/#narrow/channel/182449-t-compiler.2Fhelp/topic/Possible.20bug.20in.20unwind.20function.20in.20std/with/615883393

@rustbot rustbot added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Aug 11, 2026
@rust-log-analyzer

This comment has been minimized.

@antoyo

antoyo commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

Thanks for fixing this!

I did the test on my side and it seems to work.
Before this PR, I would get this with cg_gcc:

fatal runtime error: failed to initiate panic, error 5, aborting

and with this PR, I get the correct behavior in my reproducer.

@rust-log-analyzer

This comment has been minimized.

@nbdd0121

Copy link
Copy Markdown
Member Author

r? bjorn3

perhaps?

@nbdd0121
nbdd0121 marked this pull request as ready for review August 11, 2026 19:11
@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. and removed S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. labels Aug 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants