diff options
author | Carol Eidt <carol.eidt@microsoft.com> | 2020-08-17 21:12:26 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-08-17 21:12:26 +0300 |
commit | 2167dcf3b9bb12a65d66172307efc24a67b52be2 (patch) | |
tree | 6daad2c21915ef32a2a54d4680cfb4c7db635f74 /src/tests/Loader/CollectibleAssemblies | |
parent | 63adbf23e37be4fdc99b871cc3858a60442f56d3 (diff) |
Fix GC liveness check in ByRefLocals test (#40857)
Fix #40751
Diffstat (limited to 'src/tests/Loader/CollectibleAssemblies')
-rw-r--r-- | src/tests/Loader/CollectibleAssemblies/ByRefLocals/ByRefLocals.cs | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/src/tests/Loader/CollectibleAssemblies/ByRefLocals/ByRefLocals.cs b/src/tests/Loader/CollectibleAssemblies/ByRefLocals/ByRefLocals.cs index fb2bd107718..bad11ae9f9c 100644 --- a/src/tests/Loader/CollectibleAssemblies/ByRefLocals/ByRefLocals.cs +++ b/src/tests/Loader/CollectibleAssemblies/ByRefLocals/ByRefLocals.cs @@ -54,13 +54,17 @@ class Program Console.WriteLine(span2[0]); GC.Collect(2); GC.WaitForPendingFinalizers(); - if (gch1.Target == null) + // The loop may be unrolled, in which case things won't be live on the final iteration. + if (i < 9) { - return 1; - } - if (gch2.Target == null) - { - return 2; + if (gch1.Target == null) + { + return 1; + } + if (gch2.Target == null) + { + return 2; + } } } @@ -110,4 +114,4 @@ class Program return spanAccessor.GetSpan(); } -}
\ No newline at end of file +} |