Skip to content

Commit

Permalink
JIT: fix assert seen in some OSR cases (dotnet#68048)
Browse files Browse the repository at this point in the history
As a result of dotnet#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 dotnet#68003.
  • Loading branch information
AndyAyersMS authored Apr 15, 2022
1 parent cd8c744 commit 68dc27a
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/coreclr/jit/gschecks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,16 +53,26 @@ void Compiler::gsCopyShadowParams()
}

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

// Find groups of variables assigned to each other, and also
// tracks variables which are dereferenced and marks them as ptrs.
// Look for assignments to *p, and ptrs passed to functions
//
if (gsFindVulnerableParams())
{
// Replace vulnerable params by shadow copies.
//
gsParamsToShadows();
}
else
{
// There are no vulnerable params.
// Clear out the info to avoid looking at stale data.
//
gsShadowVarInfo = nullptr;
}
}

// This struct tracks how a tree is being used
Expand Down

0 comments on commit 68dc27a

Please sign in to comment.