Skip to content

JIT: Preserve the JIT assert definition - #137916

Merged
jakobbotsch merged 2 commits into
dotnet:mainfrom
jakobbotsch:fix-jit-assert
Nov 19, 2026
Merged

jakobbotsch merged 2 commits into
dotnet:mainfrom
jakobbotsch:fix-jit-assert

Conversation

@jakobbotsch

@jakobbotsch jakobbotsch commented Nov 19, 2026 •

Copy link
Copy Markdown
Member

#137624 stopped utilcode.h from including corhlprpriv.h in the JIT. As a result, corhlpr.h (and with it the UCRT <assert.h>) was first included after host.h, replacing the JIT's assert with the CRT one.

Remove the include eexcp.h from gcinfoencoder.h which is what ends up defining C assert. It does not seem to be necessary anymore.

Deprecate the _wassert symbol to detect this happening in the future.

dotnet#137624 stopped `utilcode.h` from including `corhlprpriv.h` in the JIT.
As a result, `corhlpr.h` (and with it the UCRT `<assert.h>`) was first
included after `host.h`, replacing the JIT's `assert` with the CRT one.

Include `corhlpr.h` before `host.h` in `jit.h`, and mark `_wassert` as
deprecated in DEBUG MSVC builds so a later CRT `<assert.h>` that
replaces the JIT's `assert` fails the build.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: c6ad27fe-95af-450c-8689-8aba56c073cf
@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 Nov 19, 2026
@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines:
Successfully started running 5 pipeline(s).
10 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.

`gcinfoencoder.h` does not use anything from `eexcp.h`, and that was
the only way the JIT reached `corhlpr.h` and its late `<assert.h>`
include. Remove the `eexcp.h` include and the `corhlpr.h` include
ordering workaround in `jit.h`.

Co-authored-by: Copilot <[email protected]>
Copilot-Session: c6ad27fe-95af-450c-8689-8aba56c073cf
@jakobbotsch

Copy link
Copy Markdown
Member Author

PTAL @dotnet/jit-contrib

Simple change that makes assert resolve to the right implementation again.

@jakobbotsch
jakobbotsch requested a review from a team November 19, 2026 14:50
@jakobbotsch

Copy link
Copy Markdown
Member Author

/ba-g Timeouts

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

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.

2 participants