Skip to content

Commit

Permalink
Adding a regression test for dotnet#81585
Browse files Browse the repository at this point in the history
  • Loading branch information
tannergooding committed Feb 6, 2023
1 parent 1671125 commit 22e79d8
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
31 changes: 31 additions & 0 deletions src/tests/JIT/Regression/JitBlue/Runtime_81585/Runtime_81585.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
// 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.Numerics;
using System.Runtime.CompilerServices;

[module: SkipLocalsInit]

class Runtime_81585
{
static int Main()
{
Vector4 a = new Vector4(new Vector2(1.051f, 2.05f), 3.478f, 1.0f);
Vector4 b = new Vector4(new Vector3(1.051f, 2.05f, 3.478f), 0.0f);
b.W = 1.0f;

float actual = Vector4.Distance(a, b);
AssertEqual(0.0f, actual);
return 100;
}

[MethodImpl(MethodImplOptions.NoInlining)]
static void AssertEqual(float expected, float actual)
{
if (expected != actual)
{
throw new Exception($"Expected: {expected}; Actual: {actual}");
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<OutputType>Exe</OutputType>
<Optimize>True</Optimize>
</PropertyGroup>
<ItemGroup>
<Compile Include="$(MSBuildProjectName).cs" />
</ItemGroup>
<ItemGroup>
<CLRTestEnvironmentVariable Include="DOTNET_JitStress" Value="1" />
</ItemGroup>
</Project>

0 comments on commit 22e79d8

Please sign in to comment.