-
Notifications
You must be signed in to change notification settings - Fork 5.4k
Closed
Labels
area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMICLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
Description
OperExceptions returns only ExceptionSetFlags::IndexOutOfRange for INDEX_ADDR nodes, but these can also throw NullReferenceException. It means that in tier-0 the following program throws IndexOutOfRangeException when it should actually throw NullReferenceException:
using System.Runtime.CompilerServices;
public class Program
{
public static void Main()
{
Bar(null, new int[0]);
}
[MethodImpl(MethodImplOptions.NoInlining)]
public static void Bar(int[] a, int[] b)
{
Consume(a[0], b[0] + 3);
}
[MethodImpl(MethodImplOptions.NoInlining)]
private static void Consume(int a, int b)
{
}
}When optimizing we expand INDEX_ADDR nodes and then call args morphing realizes that it cannot reorder these arguments.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMICLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI