Skip to content
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
2 changes: 1 addition & 1 deletion src/coreclr/jit/gentree.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33814,7 +33814,7 @@ GenTree* Compiler::gtFoldExprHWIntrinsic(GenTreeHWIntrinsic* tree)
case NI_Vector512_WithElement:
#endif
{
if ((cnsNode != op1) || !op3->OperIsConst())
if ((cnsNode != op1) || !op2->IsCnsIntOrI() || !op3->OperIsConst())
{
break;
}
Expand Down
25 changes: 25 additions & 0 deletions src/tests/JIT/Regression/JitBlue/Runtime_126060/Runtime_126060.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

namespace Runtime_126060;

using System;
using System.Runtime.CompilerServices;
using System.Runtime.Intrinsics;
using Xunit;

// gtFoldExprHWIntrinsic didn't account for a range check attached to WithElement
public class Runtime_126060
{
[Fact]
public static void TestEntryPoint()
{
Assert.Throws<ArgumentOutOfRangeException>(() => WithElementOutOfRange());
}

[MethodImpl(MethodImplOptions.NoInlining)]
private static Vector256<double> WithElementOutOfRange()
{
return Vector256.WithElement(Vector256<double>.AllBitsSet, 4, 0.0);
}
}
1 change: 1 addition & 0 deletions src/tests/JIT/Regression/Regression_ro_2.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@
<Compile Include="JitBlue\Runtime_125169\Runtime_125169.cs" />
<Compile Include="JitBlue\Runtime_125301\Runtime_125301.cs" />
<Compile Include="JitBlue\Runtime_125328\Runtime_125328.cs" />
<Compile Include="JitBlue\Runtime_126060\Runtime_126060.cs" />
</ItemGroup>
<Import Project="$(TestSourceDir)MergedTestRunner.targets" />
</Project>
Loading