summaryrefslogtreecommitdiff
path: root/tests/src/JIT/Regression/JitBlue/DevDiv_359736/DevDiv_359736.cs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/src/JIT/Regression/JitBlue/DevDiv_359736/DevDiv_359736.cs')
-rw-r--r--tests/src/JIT/Regression/JitBlue/DevDiv_359736/DevDiv_359736.cs42
1 files changed, 42 insertions, 0 deletions
diff --git a/tests/src/JIT/Regression/JitBlue/DevDiv_359736/DevDiv_359736.cs b/tests/src/JIT/Regression/JitBlue/DevDiv_359736/DevDiv_359736.cs
new file mode 100644
index 0000000000..56f7b903f3
--- /dev/null
+++ b/tests/src/JIT/Regression/JitBlue/DevDiv_359736/DevDiv_359736.cs
@@ -0,0 +1,42 @@
+// 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.Runtime.CompilerServices;
+
+// This testcase reproduces a bug where the tree re-sequencing was not correct for
+// fgMorphModToSubMulDiv(), resulting in an assert in LSRA.
+
+static class Test
+{
+ static byte GetVal()
+ {
+ return 0;
+ }
+
+ [MethodImpl(MethodImplOptions.NoInlining)]
+ static int DoMod(SByte arg)
+ {
+ byte val = GetVal();
+ return arg % val;
+ }
+
+ static int Main()
+ {
+ int returnVal = -1;
+ try
+ {
+ DoMod(4);
+ Console.WriteLine("FAILED: No exception thrown");
+ returnVal = -1;
+ }
+ catch (System.DivideByZeroException)
+ {
+ Console.WriteLine("PASS");
+ returnVal = 100;
+ }
+ return returnVal;
+ }
+}