Skip to content

Unexpected ArgumentException in Tier1 vs Tier0 #133267

Description

@EgorBo
Test(new object[4], [1, 1, 1, 1]);

[MethodImpl(MethodImplOptions.NoInlining |
    MethodImplOptions.NoOptimization)]
static int Test(object[] key, int[] fields)
{
    int c = key != null ? key.Length : 0;
    if (key is null || c <= 0 || fields.Length != c)
        throw new ArgumentException();

    int sum = 0;
    for (int i = 0; i < key.Length; i++)
        sum += fields[i];
    return sum;

}

Debug: no exception
Release: ArgumentException was thrown.

.NET 11.0, win-x64

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions