summaryrefslogtreecommitdiff
path: root/tests/src/JIT/Regression/JitBlue/GitHub_27924/GitHub_27924.cs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/src/JIT/Regression/JitBlue/GitHub_27924/GitHub_27924.cs')
-rw-r--r--tests/src/JIT/Regression/JitBlue/GitHub_27924/GitHub_27924.cs53
1 files changed, 53 insertions, 0 deletions
diff --git a/tests/src/JIT/Regression/JitBlue/GitHub_27924/GitHub_27924.cs b/tests/src/JIT/Regression/JitBlue/GitHub_27924/GitHub_27924.cs
new file mode 100644
index 0000000000..c4b8cf5be5
--- /dev/null
+++ b/tests/src/JIT/Regression/JitBlue/GitHub_27924/GitHub_27924.cs
@@ -0,0 +1,53 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+using System;
+using System.Threading;
+using System.Runtime.CompilerServices;
+using System.Collections.Generic;
+using System.Threading.Tasks;
+
+class Program
+{
+ static int returnVal = 100;
+ static byte[][] s = new byte[1000][];
+
+ static void Work()
+ {
+ for (uint i = 0; i < 1000000; i++)
+ {
+ var a = s[i++ % s.Length];
+
+ ref byte p = ref a[0];
+ ref byte q = ref a[1];
+
+ if (Unsafe.ByteOffset(ref p, ref q) != new IntPtr(1))
+ {
+ Console.WriteLine("ERROR: i = " + i);
+ returnVal = -1;
+ }
+ p = 1; q = 2;
+ }
+ }
+
+ static int Main(string[] args)
+ {
+ for(int i = 0; i < s.Length; i++) s[i] = new byte[2];
+
+ List<Task> tasks = new List<Task>();
+ for(int i = 0; i < 5; i++)
+ {
+ tasks.Add(Task.Run(Work));
+ }
+
+ Random r = new Random();
+ for (uint i = 0; i < 10000; i++)
+ {
+ s[r.Next(s.Length)] = new byte[3 + r.Next(100)];
+ }
+ Task t = Task.WhenAll(tasks);
+ t.Wait();
+ return returnVal;
+ }
+}