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) return buffer written through a widened ref to a promoted Vector4 field causes assert / AccessViolationException #135393
When a call's return buffer is a promoted 16-byte Vector4 field widened via Unsafe.As to a 32-byte struct, the JIT treats the call as defining only that field while the callee writes 32 bytes. Release runtimes crash with AccessViolationException; Checked asserts.
Assertion failed 'newLclValue.BothDefined()' in 'Program:Test(float):Pair' during 'Do value numbering' (IL size 33; hash 0xaea854bc; FullOpts)
File: src\coreclr\jit\valuenum.cpp:6745
Release runtimes (and Checked with DOTNET_ContinueOnAssert=1):
Fatal error.
System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
at Program.Test(Single)
The Unsafe.As is in bounds: p.A is at offset 0 of p, so the 32-byte write stays inside p. No repro without Unsafe is known.
The retbuf optimization in LocalAddressVisitor::EscapeAddress (lclmorph.cpp) only checks IsValidLclAddr for the start of the address, not that the 32-byte write fits in the promoted 16-byte field p.A (MorphStructFieldAddress is called with ValueSize(0)), so the call is treated as a definition of p.A only.
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.
JIT: don't treat wide retbuf writes as local defs (dotnet#137400)