Skip to content

JIT: two stack-allocated arrays in one statement crash the process #133523

Closed

Description

@EgorBo

Repro

using System;
using System.Runtime.CompilerServices;

class Program {
    [MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.AggressiveOptimization)]
    static int Test(int index) {
        int[] first = new int[3];
        int[] second = new int[3];
        return first[second[index]];
    }

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

Expected

0

Actual

Fatal error.
0xC0000005
   at Program.Main()

Platform

Windows x64, .NET 11.0.0-rc.1.26425.128. Does not reproduce on .NET 10.

Activity

  1. added this to the 12.0.0 milestone on Sep 9, 2026
  2. added
    area-CodeGen-coreclrCLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
    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. EgorBo commented on Sep 9, 2026

    @EgorBo
    MemberAuthor

    cc @AndyAyersMS might be something recent in Escape Analysis?

  5. EgorBo commented on Sep 9, 2026

    @EgorBo
    MemberAuthor

    yeah, looks like a bug in fgExpandStackArrayAllocations, let me file a fix

  6. self-assigned this
    on Sep 9, 2026
  7. added a commit that references this issue on Sep 9, 2026
    ef97eb5
  8. locked and limited conversation to collaborators on Oct 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-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