Skip to content

Commit 68dc27a

Browse files
authored
JIT: fix assert seen in some OSR cases (#68048)
As a result of #67884, OSR compilations were looking at data in the `gsShadowVarInfo` array in cases where it was not initialized. Fix is to null out `gsShadowVarInfo` array if there are no shadowed params. Fixes #68003.
1 parent cd8c744 commit 68dc27a

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

src/coreclr/jit/gschecks.cpp

+10
Original file line numberDiff line numberDiff line change
@@ -53,16 +53,26 @@ void Compiler::gsCopyShadowParams()
5353
}
5454

5555
// Allocate array for shadow param info
56+
//
5657
gsShadowVarInfo = new (this, CMK_Unknown) ShadowParamVarInfo[lvaCount]();
5758

5859
// Find groups of variables assigned to each other, and also
5960
// tracks variables which are dereferenced and marks them as ptrs.
6061
// Look for assignments to *p, and ptrs passed to functions
62+
//
6163
if (gsFindVulnerableParams())
6264
{
6365
// Replace vulnerable params by shadow copies.
66+
//
6467
gsParamsToShadows();
6568
}
69+
else
70+
{
71+
// There are no vulnerable params.
72+
// Clear out the info to avoid looking at stale data.
73+
//
74+
gsShadowVarInfo = nullptr;
75+
}
6676
}
6777

6878
// This struct tracks how a tree is being used

0 commit comments

Comments
 (0)