Skip to content

JIT: (bug) negating division by the signed minimum gives the wrong result #133517

Closed

Description

@EgorBo

Repro

using System;
using System.Runtime.CompilerServices;

class Program {
    [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.AggressiveOptimization)]
    static int Test(int x) => -(x / int.MinValue);

    static void Main() {
        Console.WriteLine(Test(int.MinValue));
    }
}

Expected

-1

int.MinValue / int.MinValue is 1, negated is -1.

Actual

1

Platform

Windows x64, .NET 11.0.0-rc.1.26425.128. Also affects long and nint.

Activity

  1. added this to the 12.0.0 milestone on Sep 9, 2026
  2. added
    area-CodeGen-coreclr
    on Sep 9, 2026
  3. dotnet-policy-service commented on Sep 9, 2026

    @dotnet-policy-service
    Contributor

    Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch
    See info in area-owners.md if you want to be subscribed.

  4. self-assigned this
    on Sep 9, 2026
  5. MihuBot commented on Sep 9, 2026

    @MihuBot

    I'm a bot. Here is a possible related and/or duplicate issue (I may be wrong):

  6. changed the title [-]JIT: negating division by the signed minimum gives the wrong result[/-] [+]JIT: (bug) negating division by the signed minimum gives the wrong result[/+] on Sep 10, 2026
  7. EgorBo commented on Sep 18, 2026

    @EgorBo
    MemberAuthor

    Affected SDK versions:

    • 11.0.100-rc.2.26467.112
  8. removed their assignment
    on Sep 21, 2026
  9. self-assigned this
    on Oct 8, 2026
  10. locked and limited conversation to collaborators on Nov 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area-CodeGen-coreclr

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions