Skip to content

Change assert in NewPutArg(), so it is consistent with transformation done by fgMorphArgs() #62379

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Dec 4, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/coreclr/jit/lower.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
39 changes: 39 additions & 0 deletions src/tests/JIT/Regression/JitBlue/Runtime_62249/Runtime_62249.cs
Original file line number Diff line number Diff line change
@@ -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<CanBeReinterpretedAsDouble, 8>, 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);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<Optimize>True</Optimize>
</PropertyGroup>
<ItemGroup>
<Compile Include="$(MSBuildProjectName).cs" />
</ItemGroup>
</Project>