Skip to content

Wrong integer promotion in release #10433

@jakobbotsch

Description

@jakobbotsch

For .NET core 2.1, the following program outputs 1023 in debug, but 255 in release.

using System;

class C0
{
    public sbyte F;
}

public class Program
{
    public static void Main()
    {
        C0 var0 = new C0 { F = -1 };
        ulong var1 = (ulong)(1000 | (byte)var0.F);
        Console.WriteLine(var1);
    }
}

This issue repros on .NET framework 4.6.1 as well with 64-bit JIT (it does not repro with 32-bit JIT). The compiler used is csc.exe 2.8.3.62923 (7aafab56).

Metadata

Metadata

Labels

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

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions