Skip to content

[WIP] Fix assertion failed during remove empty try-catch-fault - #133103

Merged
AndyAyersMS merged 2 commits into
mainfrom
copilot/fix-assertion-failed-issue
Sep 3, 2026
Merged

AndyAyersMS merged 2 commits into
mainfrom
copilot/fix-assertion-failed-issue

Conversation

Copilot AI commented Sep 2, 2026 •

Copy link
Copy Markdown
Contributor

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
16 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

Tagging subscribers to this area: @dotnet/runtime-infrastructure
See info in area-owners.md if you want to be subscribed.

Copilot AI requested a review from AndyAyersMS September 2, 2026 17:16
@AndyAyersMS
AndyAyersMS marked this pull request as ready for review September 2, 2026 19:35
Copilot AI lite review requested due to automatic review settings September 2, 2026 19:35
@AndyAyersMS

Copy link
Copy Markdown
Member

@EgorBo PTAL
Overly strong assertion

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 5 pipeline(s).
11 pipeline(s) were filtered out due to trigger conditions.
There may be pipelines that require an authorized user to comment /azp run to run.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🔵 Needs a closer look

The change touches subtle JIT flowgraph ref-count invariants in EH optimization and should get a maintainer’s final correctness review across configurations/architectures.

Pull request overview

Fixes a ref-counting invariant in the JIT’s empty try/catch/fault removal phase by accounting for additional refs to the handler/filter entry block (e.g., from internal back-edges), and adds a focused regression test to cover the scenario.

Changes:

  • Update fgRemoveEmptyTryCatchOrTryFault to decrement (rather than assert-equal/set-to-zero) the artificial bbRefs on filter/handler entry blocks.
  • Add a new JIT regression test reproducing the handler-entry back-edge case.
  • Wire the new regression test into the Regression_ro_2 merged test project.
File summaries
File Description
src/coreclr/jit/fgehopt.cpp Adjusts handler/filter entry bbRefs bookkeeping to tolerate internal back-edges when removing empty try regions.
src/tests/JIT/Regression/JitBlue/Runtime_133101/Runtime_133101.cs Adds a targeted regression test exercising the loop-in-finally-entry shape.
src/tests/JIT/Regression/Regression_ro_2.csproj Includes the new regression test in the merged runner project.
Review details
  • Files reviewed: 3/3 changed files
  • Comments generated: 0
  • Review effort level: Lite

@AndyAyersMS

Copy link
Copy Markdown
Member

/ba-g one of the build monitors is confused.

@AndyAyersMS
AndyAyersMS merged commit 454d2ab into main Sep 3, 2026
142 of 145 checks passed
@AndyAyersMS
AndyAyersMS deleted the copilot/fix-assertion-failed-issue branch September 3, 2026 14:24
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 12.0-preview1 milestone Sep 4, 2026
@jtschuster

Copy link
Copy Markdown
Member

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

JIT: Assertion failed 'firstHndBlock->bbRefs == 1' during 'Remove empty try-catch-fault 2' with a loop in the finally handler

5 participants