[JITMinOpts] JIT/Methodical/Arrays/misc/_il_relarrres/_il_relarrres.exe fails with unhandled exception
Configuration: Debug Coreclr and Mscorlib.dll Release CoreFx assemblies Release CoreCLR tests OS: Linux
Without COMPlus_JITMinOpts=1 Pass
With COMPlus_JITMinOpts=1 Fail with unhandled System.Exception thrown at GCTest.Test.Main()
Even the following test fails with the same unhandled exception JIT/Methodical/Arrays/misc/_il_dbgarrres/_il_dbgarrres.exe
Note: It needs to be investigated whether this test is supposed to fail in JITMinopts since it seems to be a GC test.
This is a dup of issue dotnet/runtime#4789. It is exactly same failure. The test fails the same way regardless MinOpts is set. It is a bad test. The issue is that manipulation of the array (adding/removing elemens, etc.) is done in the same test methods. The Jit assigns the current element of the array to a temp that holds a live reference to the last element till the end of the method, thus not collecting (finalizing) the last element. The fix would be to establish the array manipulation code in separate methods, so no temp introduced by the Jit interfere with the lifetime oif the object (as the test requires). Another possibility is to just exclude the test on all the platforms.