Updated fix for VSO 610014
authorBrian Sullivan <briansul@microsoft.com>
Fri, 6 Jul 2018 21:33:36 +0000 (14:33 -0700)
committerBrian Sullivan <briansul@microsoft.com>
Tue, 10 Jul 2018 01:23:27 +0000 (18:23 -0700)
Commit migrated from https://github.com/dotnet/coreclr/commit/295e24c01618ff3196e7bd7df60c21099ef28872

src/coreclr/src/jit/compiler.cpp

index f28394b..e547876 100644 (file)
@@ -6719,17 +6719,18 @@ START:
         }
         finallyErrorTrap()
         {
-            // Add a dummy touch to pComp so that it is kept alive, and is easy to get to
-            // during debugging since all other data can be obtained through it.
+            Compiler* pCompiler = pParamOuter->pComp;
+
+            // If OOM is thrown when allocating memory for a pComp, we will end up here.
+            // For this case, pComp and also pCompiler will be a nullptr
             //
-            if (pParamOuter->pComp) // If OOM is thrown when allocating memory for pComp, we will end up here.
-                                    // In that case, pComp is still NULL.
+            if (pCompiler != nullptr)
             {
-                pParamOuter->pComp->info.compCode = nullptr;
+                pCompiler->info.compCode = nullptr;
 
                 // pop the compiler off the TLS stack only if it was linked above
-                assert(JitTls::GetCompiler() == pParamOuter->pComp);
-                JitTls::SetCompiler(JitTls::GetCompiler()->prevCompiler);
+                assert(JitTls::GetCompiler() == pCompiler);
+                JitTls::SetCompiler(pCompiler->prevCompiler);
             }
 
             if (pParamOuter->inlineInfo == nullptr)