Enable GitHub_7147 (dotnet/coreclr#26884)
authormikedn <onemihaid@hotmail.com>
Fri, 27 Sep 2019 20:30:50 +0000 (23:30 +0300)
committerJarret Shook <jashoo@microsoft.com>
Fri, 27 Sep 2019 20:30:50 +0000 (13:30 -0700)
* Enable GitHub_7147

* Don't swallow exceptions

* Add another reordering test case

Commit migrated from https://github.com/dotnet/coreclr/commit/98125970356eed451fc29e0dbb790521d4ebe8e4

src/coreclr/tests/issues.targets
src/coreclr/tests/src/JIT/Regression/JitBlue/GitHub_7147/GitHub_7147.cs

index 244dcf5..fdd37f4 100644 (file)
@@ -59,9 +59,6 @@
         <ExcludeList Include="$(XunitTestBinBase)/tracing/tracecontrol/tracecontrol/*">
             <Issue>20299</Issue>
         </ExcludeList>
-        <ExcludeList Include="$(XunitTestBinBase)/JIT/Regression/JitBlue/GitHub_7147/GitHub_7147/*">
-            <Issue>26335</Issue>
-        </ExcludeList>
         <ExcludeList Include="$(XunitTestBinBase)/readytorun/DynamicMethodGCStress/DynamicMethodGCStress/*">
             <Issue>timeout</Issue>
         </ExcludeList>
index e647d49..08b8631 100644 (file)
@@ -47,6 +47,27 @@ namespace N
             return b;
         }
 
+        [MethodImpl(MethodImplOptions.NoInlining)]
+        static bool callargs(int x, int y, int[] a)
+        {
+            bool b = false;
+
+            for (int i = 0; i < x; i++)
+            {
+                // The following call should throw DivideByZeroException when y is 0
+                // because call arguments are expected to be evaluated in order.
+                b |= call(x / y, a.Length + x + y);
+            }
+
+            return b;
+        }
+
+        [MethodImpl(MethodImplOptions.NoInlining)]
+        static bool call(int x, int y)
+        {
+            return x == y;
+        }
+
         public static int Main(string[] args)
         {
             int errors = 0;
@@ -64,11 +85,6 @@ namespace N
                 // This is the correct result -- i / y should be evaluated and
                 // raise this exception (before c.f raises nulllref).
             }
-            catch
-            {
-                // Any exception other than DivideByZero is a failure
-                errors |= 2;
-            }
 #endif
 
             try
@@ -76,17 +92,23 @@ namespace N
                 swap(10, 11, 0, null);
                 // DivByZero should be raised from 'swap'; normal return
                 // is an error.
-                errors |= 4;
+                errors |= 2;
             }
             catch (DivideByZeroException)
             {
                 // This is the correct result -- x / y should be evaluated and
                 // raise this exception (before c.f raises nulllref).
             }
-            catch
+
+            try
+            {
+                callargs(42, 0, null);
+                // callargs shoulw always throw an exception.
+                errors |= 4;
+            }
+            catch (DivideByZeroException)
             {
-                // Any exception other than DivideByZero is a failure
-                errors |= 8;
+                // This is the expected exception
             }
 
             return 100 + errors;