diff --git a/src/coreclr/jit/lower.cpp b/src/coreclr/jit/lower.cpp index 1c9febeb131440..2467a00accdaa7 100644 --- a/src/coreclr/jit/lower.cpp +++ b/src/coreclr/jit/lower.cpp @@ -1257,7 +1257,12 @@ GenTree* Lowering::NewPutArg(GenTreeCall* call, GenTree* arg, fgArgTabEntry* inf } else if (!arg->OperIs(GT_FIELD_LIST)) { +#ifdef TARGET_ARM + assert((info->GetStackSlotsNumber() == 1) || + ((arg->TypeGet() == TYP_DOUBLE) && (info->GetStackSlotsNumber() == 2))); +#else assert(varTypeIsSIMD(arg) || (info->GetStackSlotsNumber() == 1)); +#endif } } #endif // FEATURE_PUT_STRUCT_ARG_STK diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_62249/Runtime_62249.cs b/src/tests/JIT/Regression/JitBlue/Runtime_62249/Runtime_62249.cs new file mode 100644 index 00000000000000..2bdaf33de4dbfc --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_62249/Runtime_62249.cs @@ -0,0 +1,39 @@ +// 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; + +class Runtime_62249 +{ + public struct CanBeReinterpretedAsDouble + { + public double _0; + } + + // Note that all VFP registers are occupied by d0-d7 arguments, hence the last argument is passed on the stack. + [MethodImpl(MethodImplOptions.NoInlining)] + public static int Callee(double d0, double d1, double d2, double d3, double d4, double d5, double d6, double d7, CanBeReinterpretedAsDouble onStack) + { + return onStack._0 == 62249 ? 100 : 0; + } + + public static int Caller(ref CanBeReinterpretedAsDouble byRef) + { + // Since the last parameter + // 1. Is passed by value + // 2. Has size of power of 2 + // 3. Has a single field + // morph transforms OBJ(struct, byRef) to IND(double, byRef). + // However, lower does not expect such transformation and asserts. + return Callee(0, 0, 0, 6, 2, 2, 4, 9, byRef); + } + + public static int Main(string[] args) + { + var val = new CanBeReinterpretedAsDouble(); + val._0 = 62249; + + return Caller(ref val); + } +} diff --git a/src/tests/JIT/Regression/JitBlue/Runtime_62249/Runtime_62249.csproj b/src/tests/JIT/Regression/JitBlue/Runtime_62249/Runtime_62249.csproj new file mode 100644 index 00000000000000..6946bed81bfd5b --- /dev/null +++ b/src/tests/JIT/Regression/JitBlue/Runtime_62249/Runtime_62249.csproj @@ -0,0 +1,9 @@ + + + Exe + True + + + + +