Skip to content

rangecheck bug around GT_MUL / GT_LSH #130425

Description

@EgorBo

Found by gpt-5.6 sol, repro:

using System.Runtime.CompilerServices;

internal static class Program
{
    [MethodImpl(MethodImplOptions.NoInlining)]
    private static int Test(int iterationCount)
    {
        int result = 0;
        int iteration = 0;
        for (int i = -1; (i < 0) && (iteration < iterationCount); i *= 2)
        {
            if (i < -2)
                result++;
            iteration++;
        }
        return result;
    }

    private static int Main()
    {
        int result = Test(3);
        Console.WriteLine($"Result: {result}; expected: 1");
        return result == 1 ? 100 : 1;
    }
}

Tier0: Result: 1; expected: 1
Tier1: Result: 0; expected: 1

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