Arm64 add missing G flag and possibly X flags
authorjashook <jashoo@microsoft.com>
Mon, 7 Nov 2016 21:06:20 +0000 (13:06 -0800)
committerjashook <jashoo@microsoft.com>
Mon, 7 Nov 2016 21:41:56 +0000 (13:41 -0800)
For indirections created by morphing obj(16) make sure the G and
X flag are set.

Commit migrated from https://github.com/dotnet/coreclr/commit/ba6a037fd0cd3cdf9b871d16f3564e3b2e3bd3d9

src/coreclr/src/jit/morph.cpp

index 6a6567e..b7815b4 100644 (file)
@@ -5012,7 +5012,16 @@ GenTreePtr Compiler::fgMorphMultiregStructArg(GenTreePtr arg, fgArgTabEntryPtr f
                     curAddr = baseAddr;
                 }
                 GenTreePtr curItem = gtNewOperNode(GT_IND, type[inx], curAddr);
-                listEntry          = new (this, GT_FIELD_LIST) GenTreeFieldList(curItem, offset, type[inx], listEntry);
+
+                // For safety all GT_IND should have at least GT_GLOB_REF set.
+                curItem->gtFlags |= GTF_GLOB_REF;
+                if (fgAddrCouldBeNull(curItem))
+                {
+                    // This indirection can cause a GPF if the address could be null.
+                    curItem->gtFlags |= GTF_EXCEPT;
+                }
+
+                listEntry = new (this, GT_FIELD_LIST) GenTreeFieldList(curItem, offset, type[inx], listEntry);
                 if (newArg == nullptr)
                 {
                     newArg = listEntry;