Skip to content

Commit f9aefb9

Browse files
Add a test
1 parent 92c4cc9 commit f9aefb9

File tree

1 file changed

+36
-0
lines changed

1 file changed

+36
-0
lines changed

src/tests/JIT/Directed/StructABI/TypeMismatchedArgs.cs

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,11 @@ public static int Main()
4141
return 105;
4242
}
4343

44+
if (ProblemWithRegFileMismatch_Win_x64(12, 13))
45+
{
46+
return 106;
47+
}
48+
4449
return 100;
4550
}
4651

@@ -86,6 +91,21 @@ private static bool ProblemWithVectorCallArg()
8691
return result != s_vtor128.Vtor4.X;
8792
}
8893

94+
[MethodImpl(MethodImplOptions.NoInlining)]
95+
private static bool ProblemWithRegFileMismatch_Win_x64(double dbl, float flt)
96+
{
97+
if (CallForDblStruct(*(DblStruct*)&dbl) != dbl)
98+
{
99+
return true;
100+
}
101+
if (CallForFltStruct(*(FltStruct*)&flt) != flt)
102+
{
103+
return true;
104+
}
105+
106+
return false;
107+
}
108+
89109
[MethodImpl(MethodImplOptions.NoInlining)]
90110
private static float CallForVector4(Vector4 value) => value.X;
91111

@@ -97,6 +117,12 @@ private static bool ProblemWithVectorCallArg()
97117

98118
[MethodImpl(MethodImplOptions.NoInlining)]
99119
private static long CallForSplitStructWithFourLongs(int arg0, int arg1, StructWithFourLongs splitArg) => splitArg.LongOne;
120+
121+
[MethodImpl(MethodImplOptions.NoInlining)]
122+
private static double CallForDblStruct(DblStruct value) => value.Dbl;
123+
124+
[MethodImpl(MethodImplOptions.NoInlining)]
125+
private static float CallForFltStruct(FltStruct value) => value.Flt;
100126
}
101127

102128
[StructLayout(LayoutKind.Explicit)]
@@ -170,3 +196,13 @@ struct FourDoublesHfaStruct
170196
public double ThirdDblValue;
171197
public double FourthDblValue;
172198
}
199+
200+
struct DblStruct
201+
{
202+
public double Dbl;
203+
}
204+
205+
struct FltStruct
206+
{
207+
public float Flt;
208+
}

0 commit comments

Comments
 (0)