Skip to content

Commit

Permalink
defMAC construction up a scope to make it live long enough. (#54702)
Browse files Browse the repository at this point in the history
Fixes #54649
  • Loading branch information
jkoritzinsky authored Jun 24, 2021
1 parent 20ff641 commit 75b6c99
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/coreclr/jit/morph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6046,6 +6046,10 @@ GenTree* Compiler::fgMorphField(GenTree* tree, MorphAddrContext* mac)
}
#endif

// Create a default MorphAddrContext early so it doesn't go out of scope
// before it is used.
MorphAddrContext defMAC(MACK_Ind);

/* Is this an instance data member? */

if (objRef)
Expand Down Expand Up @@ -6136,7 +6140,6 @@ GenTree* Compiler::fgMorphField(GenTree* tree, MorphAddrContext* mac)

// NULL mac means we encounter the GT_FIELD first. This denotes a dereference of the field,
// and thus is equivalent to a MACK_Ind with zero offset.
MorphAddrContext defMAC(MACK_Ind);
if (mac == nullptr)
{
mac = &defMAC;
Expand Down

0 comments on commit 75b6c99

Please sign in to comment.