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) [ARM64] Contained BITCAST in a small (byte/short) STORE_LCL_FLD emits an oversized store and clobbers adjacent fields #134054
Storing a BITCAST-ed float into a byte struct field emits a full 4-byte store, overwriting the neighbouring field. Checked arm64 asserts dstSize == 8 in instr.cpp; Release arm64 and x64 silently corrupt the struct.
13108 == 0x3334: s.B is correct but s.C was overwritten with 0x33. Checked arm64 instead asserts:
Assertion failed 'dstSize == 8' in 'Program:Test(float):int' during 'Generate code'
File: src/coreclr/jit/instr.cpp:2647
Codegen shows str s16, [fp, #0x18] (4 bytes) into the 1-byte field s.B; on x64 the equivalent movss.
Notes
Lowering::ContainCheckStoreLoc (lowerarmarch.cpp, same shape in lowerxarch.cpp) contains any GT_BITCAST whose source is in a register without checking that the store width is 4 or 8 bytes. genCodeForStoreLclFld then calls ins_StoreFromSrc(fpReg, TYP_UBYTE), which only handles 4/8-byte
destinations. fgOptimizeCastOnStore drops the (byte) cast on the STORE_LCL_FLD path, leaving the
raw BITCAST as the store data. Fix direction: refuse containment (or emit an exact-width store) when genTypeSize(store) < 4. Also reproduces on .NET 10.0.9, so not a .NET 11 regression.
Activity
dotnet-policy-service commentedon Sep 16, 2026
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch
See info in area-owners.md if you want to be subscribed.
JIT: don't contain BITCAST under small local stores (#135595)