Description
Description
When running the provided C# file on Linux under Release configuration, the background tiered compilation thread hits a segfault in LinearScan::processBlockStartLocations. Specifically this line: https://github.com/dotnet/runtime/blob/v10.0.4/src/coreclr/jit/lsra.cpp#L4591, while compiling the ProblematicBody method. Which seems very similar in symptoms at least to this old .NET 5 bug #49489 .
Converting the wrapper structs to a non-explicit layout and accessing the components via properties avoids the crash. Running in Debug configuration does not crash.
Reproduction Steps
Run with dotnet run -c Release Program.cs
Expected behavior
The application runs successfully.
Actual behavior
The application segfaults.
Regression?
Unknown. Apparently doesn't occur on .NET 8 but I haven't confirmed this myself.
Known Workarounds
As above - making this not an explicit struct fixes the issue. As, of course, would using the relevant Numerics structs directly.
Configuration
.NET 10.0.4 (SDK 10.0.104)
Linux (EndeavourOS) Kernel 7.0.5-arch1-1
x64
Also confirmed by someone else on Arch 7.0.8-arch1-1.
Other information
No response
Activity
dotnet-policy-service commentedon May 19, 2026
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch
See info in area-owners.md if you want to be subscribed.
JIT: expand promoted struct LCL_VAR entries in GT_FIELD_LIST during m…
JIT: don't propagate promoted struct LCL_VAR into FIELD_LIST uses
JIT: don't propagate promoted SIMD LCL_VAR into FIELD_LIST uses
tannergooding commentedon Jul 7, 2026
@SamboyCoding, I'd note that while this is a bug and we are fixing it, your code is currently pessimizing itself "a lot" by using explicit layout structs like this.
You should not be using public fields, you should not be overlapping fields, you should not be using non-0 based field offsets, etc.
Rather, if you want optimal codegen here then you should simply wrap the
System.Numericstype as the internal private value field and expose properties which get/set the respective field so that the various JIT optimizations can light up and give you the expected optimal codegen.If you cannot do that, such as due to binary compat, then the next best thing is to use
Unsafe.BitCastto convert between your struct and the correspondingSystem.Numericstype with an identical layout, and then to use the operators on the built-in types before casting back. This allows the JIT to flag your type as being used in SIMD intrinsics and still generally optimize as expected.i.e. this is as close to optimal as you can get with a wrapper type:
and if you can't do that only because you already have public fields exposed, this is the next closest thing:
JIT: don't propagate promoted struct LCL_VAR into FIELD_LIST uses (#1…
SamboyCoding commentedon Jul 11, 2026
Yeah I've already had this changed for weeks at this point, but glad to know it's fixed now.
JIT: don't propagate promoted struct LCL_VAR into FIELD_LIST uses (#1…
[release/10.0] JIT: don't propagate promoted struct LCL_VAR into FIEL…