diff --git a/src/coreclr/jit/importercalls.cpp b/src/coreclr/jit/importercalls.cpp index 5622b2ca5835aa..f8acff469f4308 100644 --- a/src/coreclr/jit/importercalls.cpp +++ b/src/coreclr/jit/importercalls.cpp @@ -1475,8 +1475,7 @@ var_types Compiler::impImportCall(OPCODE opcode, varDsc->lvType = call->AsCall()->gtReturnType; } - // TODO-Bug: CHECK_SPILL_NONE here looks wrong. - impStoreToTemp(calliSlot, call, CHECK_SPILL_NONE); + impStoreToTemp(calliSlot, call, CHECK_SPILL_ALL); // impStoreToTemp can change src arg list and return type for call that returns struct. var_types type = genActualType(lvaTable[calliSlot].TypeGet()); call = gtNewLclvNode(calliSlot, type); diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_116689/Runtime_116689.cs b/src/tests/JIT/Regression/JitBlue/Runtime_116689/Runtime_116689.cs new file mode 100644 index 00000000000000..7a7c5d8f5d1be5 --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_116689/Runtime_116689.cs @@ -0,0 +1,28 @@ +// Licensed to the .NET Foundation under one or more agreements. +// The .NET Foundation licenses this file to you under the MIT license. + +using System.Runtime.CompilerServices; +using Xunit; + +public unsafe class Runtime_116689 +{ + [Fact] + public static int TestEntryPoint() + { + s_value = -1; + return Test(&GetVal); + } + + private static int s_value; + [MethodImpl(MethodImplOptions.NoInlining)] + private static unsafe int Test(delegate* foo) + { + return s_value + foo(); + } + + private static int GetVal() + { + s_value = 0; + return 101; + } +} diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_116689/Runtime_116689.csproj b/src/tests/JIT/Regression/JitBlue/Runtime_116689/Runtime_116689.csproj new file mode 100644 index 00000000000000..de6d5e08882e86 --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_116689/Runtime_116689.csproj @@ -0,0 +1,8 @@ + + + True + + + + +