Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Add a test
  • Loading branch information
SingleAccretion committed Jun 16, 2022
commit 0ed26279f512f6543cfcf0dd006566cddfa0d885
48 changes: 48 additions & 0 deletions src/tests/JIT/Regression/JitBlue/Runtime_70824/Runtime_70824.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System.Numerics;
using System.Runtime.CompilerServices;

public unsafe class Runtime_70824
{
public static int Main()
{
long lng = 2;
float flt = 3;
Vector2 vtor = new Vector2(4, 5);
float[] arr = new float[] { 6, 7 };

if (ProblemWithTypes(&lng, &flt, vtor))
{
return 101;
}
if (ProblemWithAddrs(&flt, arr, vtor))
{
return 102;
}

return 100;
}

[MethodImpl(MethodImplOptions.NoInlining)]
private static bool ProblemWithTypes(long* p1, float* pF, Vector2 vtor)
{
*pF = vtor.X;
*p1 = (long)*pF;

return *p1 != (long)*pF;
}

[MethodImpl(MethodImplOptions.NoInlining)]
private static bool ProblemWithAddrs(float* pF, float[] arr, Vector2 vtor)
{
*pF = vtor.X;
arr[0] = vtor.Y;

arr[1] = vtor.X;
*pF = vtor.Y;

return arr[0] != vtor.Y || *pF != vtor.Y;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<Optimize>True</Optimize>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<ItemGroup>
<Compile Include="$(MSBuildProjectName).cs" />
</ItemGroup>
</Project>