| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
There was a problem hiding this comment.
This PR backports a fix to the JIT to address an issue where explicit zeroing of struct fields gets mistakenly removed in methods without .localsinit (when the SkipLocalsInit attribute is applied).
Copilot reviewed 3 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| src/tests/JIT/Regression/JitBlue/Runtime_113658/Runtime_113658.csproj | New test project configuration for JIT regression. |
| src/tests/JIT/Regression/JitBlue/Runtime_113658/Runtime_113658.cs | New test validating correct zeroing behavior. |
| src/coreclr/jit/morphblock.cpp | Introduces calls to kill dependent assertions in field-by-field initialization and copy paths to prevent incorrect removal of zeroing. |
src/coreclr/jit/morphblock.cpp:409
m_comp->fgKillDependentAssertionsSingle(m_dstLclNum DEBUGARG(m_store));
src/coreclr/jit/morphblock.cpp:1238
m_comp->fgKillDependentAssertionsSingle(m_dstLclNum DEBUGARG(m_store));
Sorry, something went wrong.
There was a problem hiding this comment.
lgtm. please get a code review. we will take for consideration in 9.0.x
Sorry, something went wrong.
|
Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch |
Sorry, something went wrong.
| Back | FazBrowse Home | New Git URL |
Backport of #115556 to release/9.0-staging
Customer Impact
The JIT may mistakenly remove explicit field zeroing for some struct fields in methods without .localsinit (e.g. by having the SkipLocalsInit attribute applied in C#). This can happen when the IL first zero-initializes the full struct local using e.g. initobj, and then later zeroes a particular field of the struct local using stfld. Under certain circumstances, the JIT mistakenly eliminates both explicit zeroings of the field, leaving no zero initialization present, resulting in the field containing stack garbage.
Reported by customer in #113658.
Regression
This was exposed by support for cross-block assertion prop enabled in #94689.
Testing
Unit test added, and tested manually on user's test case.
Risk
Low