Skip to content

Conversation

@AndyAyersMS
Copy link
Member

If the try/finally has an unreachable continuation (eg the finally throws), morph may have already cleared out the continuation block, so we won't find a GT_END_LFIN there. Tolerate.

Fixes #115700

…tinuation

Morph may have already cleared out the continuation block, so we won't find
a GT_END_LFIN there.

Fixes dotnet#115700
Copilot AI review requested due to automatic review settings May 19, 2025 17:30
@AndyAyersMS
Copy link
Member Author

@dotnet/jit-contrib PTAL

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR addresses an x86 EH issue in the JIT by tolerating the case where the try/finally block has an unreachable continuation (e.g., when the finally throws and the continuation is cleared). The key changes include adding a new test to trigger the scenario and modifying the continuation cleanup logic in the JIT to account for empty throw blocks.

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.

File Description
src/tests/JIT/Regression/JitBlue/Runtime_115700/Runtime_115700.csproj New project file for the regression test
src/tests/JIT/Regression/JitBlue/Runtime_115700/Runtime_115700.cs Test case to reproduce the condition where the finally throws
src/coreclr/jit/fgehopt.cpp Update to fgCleanupContinuation to tolerate an empty BBJ_THROW continuation

@github-actions github-actions bot added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label May 19, 2025
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@dotnet-policy-service
Copy link
Contributor

Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch
See info in area-owners.md if you want to be subscribed.

Copy link
Contributor

@amanasifkhalid amanasifkhalid left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Looks like jit-format is broken again?

@AndyAyersMS
Copy link
Member Author

Formatting error is in codegenxarch, unrelated. I can fix it here I guess.

@AndyAyersMS
Copy link
Member Author

Lots of time outs.. .this change should be very safe an unblocks formatting, so going to merge.

@AndyAyersMS
Copy link
Member Author

/ba-g lots of timeouts

@AndyAyersMS AndyAyersMS merged commit a78f02b into dotnet:main May 19, 2025
101 of 114 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Jun 19, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI

Projects

None yet

Development

Successfully merging this pull request may close these issues.

JIT: Assertion failed 'foundEndLFin' during 'Remove empty try 2'

2 participants