Skip to content

JIT: Respect offsets in non-null assertion propagation - #133685

Merged
EgorBo merged 2 commits into
dotnet:mainfrom
EgorBo:fix-jit-nonnull-offset-133678
Sep 14, 2026
Merged

EgorBo merged 2 commits into
dotnet:mainfrom
EgorBo:fix-jit-nonnull-offset-133678

Conversation

@EgorBo

@EgorBo EgorBo commented Sep 11, 2026

Copy link
Copy Markdown
Member

Fixes #133678

Co-authored-by: Copilot <[email protected]>
Copilot-Session: d99943f7-682c-481d-b9d6-4f4c94bde485
Copilot AI lite review requested due to automatic review settings September 11, 2026 11:51
@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 Sep 11, 2026
@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.

@dotnet-policy-service

Copy link
Copy Markdown
Contributor

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

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.

🟢 Approval recommended

No unresolved review issues remain.

Pull request overview

Fixes a JIT bug where non-null assertions were incorrectly propagated through invalid pointer offsets.

Changes:

  • Rejects negative and oversized peeled offsets.
  • Adds regression coverage for the expected NullReferenceException.
File summaries
File Description
src/tests/JIT/Regression_ro_2/Runtime_133678.cs Adds regression coverage.
src/coreclr/jit/assertionprop.cpp Prevents invalid offset propagation.
Review details
  • Files reviewed: 2/2 changed files
  • Comments generated: 0
  • Review effort level: Lite

@EgorBo
EgorBo requested a review from jakobbotsch September 11, 2026 12:01
@EgorBo

EgorBo commented Sep 11, 2026 •

Copy link
Copy Markdown
Member Author

PTAL @jakobbotsch @dotnet/jit-contrib. Not sure PeelOffset itself should do it, probably not, so it's caller responsibility (not all of them care about the offset being too big).

Copilot AI review requested due to automatic review settings September 14, 2026 11:58
@EgorBo

EgorBo commented Sep 14, 2026 •

Copy link
Copy Markdown
Member Author

@jakobbotsch I deleted the test, I agree it doesn't have much value, but I presume we still need to check IsOffsetBig when we make a "is not null" assumption about (X + CNS) tree based only on X status. We never know what IR CSE migth produce (the one that splits constants to base + delta). So X might be not null, but CNS subtracts its entire address from it.

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 correctness-sensitive JIT change lacks the requested targeted regression test, so final human approval is warranted.

Review details
  • Files reviewed: 1/1 changed files
  • Comments generated: 1
  • Review effort level: Lite

Comment thread src/coreclr/jit/assertionprop.cpp Resolved
@EgorBo
EgorBo merged commit f9b470a into dotnet:main Sep 14, 2026
134 of 137 checks passed
@dotnet-milestone-bot dotnet-milestone-bot Bot added this to the 12.0-preview1 milestone Sep 15, 2026
jtschuster pushed a commit to jtschuster/runtime that referenced this pull request Sep 18, 2026
Fixes dotnet#133678

---------

Co-authored-by: Copilot <[email protected]>
Copilot-Session: d99943f7-682c-481d-b9d6-4f4c94bde485
@github-actions github-actions Bot locked and limited conversation to collaborators Oct 15, 2026
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: (bug) NullReferenceException dropped - non-null assertion ignores the peeled offset

3 participants