You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
JIT: (bug) single-field struct copy into a short local skips normalization (assert 'srcFld->IsIntegralConst()' / wrong value) #135394
Copying a single-short-field struct into a short local via Unsafe.As<short, W> skips the sign-extension, so Test returns 65535 instead of -1 (Checked builds assert).
Assertion failed 'srcFld->IsIntegralConst()' in 'Program:Test(W):int' during 'Morph - Global' (IL size 17; hash 0xadfebca2; FullOpts)
File: src\coreclr\jit\morphblock.cpp:1401
Release runtimes (and Checked with DOTNET_ContinueOnAssert=1) print 65535: Test compiles to mov eax, ecx; ret, with no movsx.
Regression?
Yes, regression in .NET 10 (win-x64):
.NET 8.0.31, 9.0.20: -1 (correct)
.NET 10.0.12, 11.0.0-rc.2: 65535
main (Checked): the assert above
Notes
Unsafe.As<short, W> is a same-size, in-bounds reinterpretation (W is exactly one short), so the program is well-defined.
MorphCopyBlockHelper::CopyFieldByField (morphblock.cpp, m_dstSingleStoreLclVar path) turns the block copy into STORE_LCL_VAR int V01 of LCL_VAR short V03 (the promoted field) via gtNewStoreLclVarNode, without a normalizing cast for the normalize-on-store short local.
Activity
dotnet-policy-service commentedon Oct 8, 2026
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch
See info in area-owners.md if you want to be subscribed.