From 15231fbde7b3f41c495741cb0d5dad9037517542 Mon Sep 17 00:00:00 2001 From: Jakob Botsch Nielsen Date: Fri, 17 Jun 2022 15:20:24 +0200 Subject: [PATCH] Add test --- .../JitBlue/Runtime_63905/Runtime_63905.cs | 46 +++++++++++++++++++ .../Runtime_63905/Runtime_63905.csproj | 9 ++++ 2 files changed, 55 insertions(+) create mode 100644 src/tests/JIT/Regression/JitBlue/Runtime_63905/Runtime_63905.cs create mode 100644 src/tests/JIT/Regression/JitBlue/Runtime_63905/Runtime_63905.csproj diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_63905/Runtime_63905.cs b/src/tests/JIT/Regression/JitBlue/Runtime_63905/Runtime_63905.cs new file mode 100644 index 0000000000000..5749133e9ee55 --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_63905/Runtime_63905.cs @@ -0,0 +1,46 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System; +using System.Runtime.CompilerServices; + +public class Runtime_63905 +{ + public static int Main() + { + C c = GetNull(); + int i = GetOne(); + try + { + Foo(c.Field, i / 0); + } + catch (NullReferenceException) + { + Console.WriteLine("PASS: Caught NullReferenceException in first argument"); + return 100; + } + catch (DivideByZeroException) + { + Console.WriteLine("FAIL: Arguments were reordered incorrectly"); + return -1; + } + + return -1; + } + + [MethodImpl(MethodImplOptions.NoInlining)] + private static C GetNull() => null; + + [MethodImpl(MethodImplOptions.NoInlining)] + private static int GetOne() => 1; + + [MethodImpl(MethodImplOptions.NoInlining)] + private static void Foo(object o, int val) + { + } + + private class C + { + public object Field; + } +} diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_63905/Runtime_63905.csproj b/src/tests/JIT/Regression/JitBlue/Runtime_63905/Runtime_63905.csproj new file mode 100644 index 0000000000000..f492aeac9d056 --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_63905/Runtime_63905.csproj @@ -0,0 +1,9 @@ + + + Exe + True + + + + + \ No newline at end of file