Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move defMAC construction up a scope to make it live long enough. #54702

Merged
1 commit merged into from
Jun 24, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/coreclr/jit/morph.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6040,6 +6040,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 @@ -6130,7 +6134,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