Report that allocations may have side effects for all types outside of the version...
authorDavid Wrighton <davidwr@microsoft.com>
Mon, 26 Jul 2021 19:59:58 +0000 (12:59 -0700)
committerGitHub <noreply@github.com>
Mon, 26 Jul 2021 19:59:58 +0000 (12:59 -0700)
Fixes #45628

src/coreclr/tools/aot/ILCompiler.ReadyToRun/JitInterface/CorInfoImpl.ReadyToRun.cs

index e3da2dc..6a325a5 100644 (file)
@@ -1142,6 +1142,10 @@ namespace Internal.JitInterface
 
             pHasSideEffects = type.HasFinalizer;
 
+            // If the type isn't within the version bubble, it could gain a finalizer. Always treat it as if it has a finalizer
+            if (!pHasSideEffects && !_compilation.NodeFactory.CompilationModuleGroup.VersionsWithType(type))
+                pHasSideEffects = true;
+
             return CorInfoHelpFunc.CORINFO_HELP_NEWFAST;
         }