Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/dotnet/runtime.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJeremy Koritzinsky <jekoritz@microsoft.com>2021-06-25 02:40:40 +0300
committerGitHub <noreply@github.com>2021-06-25 02:40:40 +0300
commit75b6c99e2c704b3e366ce86020633c517a821d61 (patch)
tree4db5f6672f5989f42519cc5d04a1941649987bc3 /src/coreclr/jit
parent20ff641973d5d66f6eda52bccaf3b86786d11f4e (diff)
defMAC construction up a scope to make it live long enough. (#54702)
Fixes #54649
Diffstat (limited to 'src/coreclr/jit')
-rw-r--r--src/coreclr/jit/morph.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/coreclr/jit/morph.cpp b/src/coreclr/jit/morph.cpp
index 6d7f8c7bc6f..e53c2d9e8ff 100644
--- a/src/coreclr/jit/morph.cpp
+++ b/src/coreclr/jit/morph.cpp
@@ -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)
@@ -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;