Skip to content

Entire indirect stores denormalize normalize-on-store locals #77379

@SingleAccretion

Description

@SingleAccretion

Reproduction:

Console.WriteLine(Problem(0));

[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.AggressiveOptimization)]
static short Problem(byte x)
{
    short a = -1;
    Unsafe.InitBlock(&a, x, 2);
    
    return a;
}

Compile and run.

Expected result: the program prints 0.

Actual result: the program prints -65536.

Cause: normalize-on-store assumes all entire stores overwrite the full stack slot.

Metadata

Metadata

Assignees

No one assigned

    Labels

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

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions