Skip to content

JIT: Incorrectly optimized double-negation in face of inlining #61908

Closed
@jakobbotsch

Description

@jakobbotsch

Description

The following program has different behavior in debug and release mode.

Reproduction Steps

// Generated by Fuzzlyn v1.5 on 2021-11-21 16:25:19
// Run on Arm64 Linux
// Seed: 3319480715990956994
// Reduced from 26.2 KiB to 0.4 KiB in 00:00:42
// Debug: No output
// Release: Prints 0
public class Program
{
    public static bool s_3;
    public static void Main()
    {
        var vr6 = M3(s_3);
        if (M3(vr6))
        {
            System.Console.WriteLine(0);
        }
    }

    public static bool M3(bool arg0)
    {
        arg0 = !arg0;
        return arg0;
    }
}

Expected behavior

Same behavior.

Actual behavior

Different behavior.

Regression?

No response

Known Workarounds

No response

Configuration

No response

Other information

Does not repro with .NET 6.

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