Skip to content

JIT: Wrong result with do-while loops #115109

Open
@jakobbotsch

Description

@jakobbotsch
// Generated by Fuzzlyn v2.8 on 2025-04-27 22:46:08
// Run on X86 Windows
// Seed: 2255917678885586044-vectort,vector128,vector256,x86aes,x86avx,x86avx2,x86avx512bw,x86avx512bwvl,x86avx512cd,x86avx512cdvl,x86avx512dq,x86avx512dqvl,x86avx512f,x86avx512fvl,x86bmi1,x86bmi2,x86fma,x86lzcnt,x86pclmulqdq,x86popcnt,x86sse,x86sse2,x86sse3,x86sse41,x86sse42,x86ssse3,x86x86base
// Reduced from 118.3 KiB to 1.0 KiB in 00:17:25
// Debug: Outputs <0, 0, 0, 0, 0, 0, 0, 0>
// Release: Outputs <1, 0, 0, 0, 0, 0, 0, 0>
using System;
using System.Numerics;
using System.Runtime.Intrinsics;
using System.Runtime.Intrinsics.X86;

public class Program
{
    public static IRuntime s_rt;
    public static int s_5 = 1;
    public static Vector<int>[] s_10 = new Vector<int>[]
    {
        Vector128.CreateScalar(0).AsVector()
    };
    public static byte s_21;
    public static void Main()
    {
        s_rt = new Runtime();
        bool vr5 = 0 <= M10();
        s_rt.WriteLine(s_10[0]);
    }

    public static byte M10()
    {
        byte lvar2 = default(byte);
        do
        {
            s_5 = 0;
            int lvar4 = 0;
            do
            {
                s_10[0] = Vector128.CreateScalar(s_5).AsVector();
            }
            while (lvar4 < 0);
        }
        while (lvar2 > 1);
        return s_21;
    }
}

public interface IRuntime
{
    void WriteLine<T>(T value);
}

public class Runtime : IRuntime
{
    public void WriteLine<T>(T value) => System.Console.WriteLine(value);
}

cc @dotnet/jit-contrib

Metadata

Metadata

Assignees

Labels

area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMIblocking-clean-ci-optionalBlocking optional rolling runs

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions