Fix Enum.Equals folding for nullable boxed arguments - #133826
Conversation
|
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. |
|
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
Co-authored-by: EgorBo <523221+EgorBo@users.noreply.github.com>
|
@copilot fix ci failures |
Co-authored-by: EgorBo <523221+EgorBo@users.noreply.github.com>
Fixed in e2f6aba. Enum-valued |
|
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. |
There was a problem hiding this comment.
🟢 Approval recommended
The fix is narrowly scoped and includes regression coverage with no unresolved review comments.
Pull request overview
Fixes JIT Enum.Equals folding for nullable enum values that box to null.
Changes:
- Guard payload comparison until the argument is known non-null.
- Add nullable-boxing regression tests.
File summaries
| File | Description |
|---|---|
src/tests/JIT/Intrinsics/EnumIntrinsics.cs |
Adds null, equal, and unequal nullable-boxing coverage. |
src/coreclr/jit/gentree.cpp |
Prevents unsafe folding of nullable boxed arguments. |
Review details
- Files reviewed: 2/2 changed files
- Comments generated: 0
- Review effort level: Lite
|
PTAL @jakobbotsch @dotnet/jit-contrib |
|
ping @jakobbotsch, presumably, simple change |
|
/ba-g DIC failure is already fixed in main |
Boxing a nullable enum can yield
nullwhile retaining an exact enum type.Enum.Equalsfolding currently dereferences that argument, throwing instead of returningfalse.Enum.Equalsfolding throwsNullReferenceExceptioninstead of returningfalsefor anullargument #133817