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
3 changes: 2 additions & 1 deletion src/coreclr/jit/assertionprop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5786,7 +5786,8 @@ bool Compiler::optCreateJumpTableImpliedAssertions(BasicBlock* switchBb)
// default: %name.Length is >= 8 here%
// }
//
if ((value > 0) && !vnStore->IsVNConstant(opVN))
// NOTE: if offset != 0, we only know that "X + offset >= maxJumpIdx", which is not very useful.
if ((offset == 0) && (value > 0) && !vnStore->IsVNConstant(opVN))
{
AssertionDsc dsc = {};
dsc.assertionKind = OAK_NOT_EQUAL;
Expand Down
47 changes: 47 additions & 0 deletions src/tests/JIT/Regression/JitBlue/Runtime_122254/Runtime_122254.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
// 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;
using Xunit;

public class Runtime_122254
{
[Fact]
public static void TestEntryPoint()
{
try
{
Test(new int[0]);
}
catch (InvalidOperationException)
{
return;
}
throw new InvalidOperationException();
}

[MethodImpl(MethodImplOptions.NoInlining)]
private static void Test(int[] arr)
{
int block = arr.Length;
switch (block)
{
case 2:
Console.WriteLine("2");
break;
case 3:
Console.WriteLine("3");
break;
case 4:
Console.WriteLine("4");
break;
default:
if (block == 0)
{
throw new InvalidOperationException();
}
break;
}
}
}
Loading