Skip to content

JIT: Remove dataSection flexible array#124373

Merged
jakobbotsch merged 3 commits intodotnet:mainfrom
jakobbotsch:fix-124350
Feb 16, 2026
Merged

JIT: Remove dataSection flexible array#124373
jakobbotsch merged 3 commits intodotnet:mainfrom
jakobbotsch:fix-124350

Conversation

@jakobbotsch
Copy link
Member

Storing pointers and emitLocation instances in this BYTE flexible array is problematic due to alignment. We could use alignas, but the flexible array here is a micro optimization so just go with a simpler representation without the footguns.

Fix #124350

Storing pointers and `emitLocation` instances in this `BYTE` flexible
array is problematic due to alignment. We could use `alignas`, but the
flexible array here is a micro optimization so just go with a simpler
representation without the footguns.
Copilot AI review requested due to automatic review settings February 13, 2026 10:35
@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 Feb 13, 2026
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 pull request addresses a critical ARM32 crash caused by misaligned memory access in the JIT compiler's data section handling (issue #124350). The fix removes a problematic flexible array (dsCont[0]) from the dataSection struct and replaces it with a union of properly typed pointers. This eliminates alignment issues that arose from storing pointers and emitLocation instances in a BYTE array.

Changes:

  • Replaced flexible array dsCont[0] with a union containing dsData (BYTE*), dsBlocks (BasicBlock**), and dsLocations (emitLocation*) members
  • Updated all data section allocation code to separately allocate the descriptor and the data/blocks/locations arrays
  • Updated all access sites to use the appropriate union member based on the section type

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.

Show a summary per file
File Description
src/coreclr/jit/emit.h Replaced flexible array dsCont[0] with a union of typed pointers (dsData, dsBlocks, dsLocations)
src/coreclr/jit/emit.cpp Updated memory allocation to separately allocate dataSection and data arrays; updated all access sites to use union members
src/coreclr/jit/emitxarch.cpp Updated display code to use dsBlocks instead of casting dsCont
src/coreclr/jit/codegenlinear.cpp Updated async resume info recording to use dsLocations
src/coreclr/jit/codegencommon.cpp Updated async debug info reporting to use dsLocations

Copilot AI review requested due to automatic review settings February 13, 2026 11:09
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

Copilot reviewed 6 out of 6 changed files in this pull request and generated no new comments.

@rzikm
Copy link
Member

rzikm commented Feb 13, 2026

/azp run runtime-extra-platforms

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@jakobbotsch
Copy link
Member Author

It's quite a mystery to me why this wouldn't be failing widely on arm32. Any time we have a suspension we should have this misaligned load.
Perhaps there is some difference in the queues being used and whether or not the misaligned loads get handled by the kernel.

@rzikm
Copy link
Member

rzikm commented Feb 13, 2026

@rzikm
Copy link
Member

rzikm commented Feb 13, 2026

/azp run runtime-libraries coreclr-outerloop

@azure-pipelines
Copy link

No pipelines are associated with this pull request.

@rzikm
Copy link
Member

rzikm commented Feb 13, 2026

/azp run runtime-libraries-coreclr outerloop-linux

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@jakobbotsch
Copy link
Member Author

PTAL @dotnet/jit-contrib

@jakobbotsch
Copy link
Member Author

/ba-g Deadletter and ILC failure is likely similar to #124370

@jakobbotsch jakobbotsch merged commit 3249bf9 into dotnet:main Feb 16, 2026
178 of 189 checks passed
@jakobbotsch jakobbotsch deleted the fix-124350 branch February 16, 2026 12:00
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.

[linux-arm32] Crash caused by misaligned access under genReportAsyncDebugInfo

4 participants