Skip to content

Required memory PHIs are not added for un-analyzable memory stores by SSA #86112

Description

@SingleAccretion

Reproduction:

static int _intStatic;

[MethodImpl(MethodImplOptions.NoInlining | MethodImplOptions.AggressiveOptimization)]
public static bool Problem()
{
    [MethodImpl(MethodImplOptions.NoInlining)]
    static void Throw()
    {
        _intStatic = 1;
        throw new Exception();
    }

    _intStatic = 2;

    try
    {
        Throw();
        _intStatic = 2;
    }
    catch (Exception)
    {
        if (_intStatic == 2)
        {
            return true;
        }
    }

    return false;
}

Call Problem().

Expected result: false.
Actual result: true.

Cause: each possible modification of globally visible memory in a protected region must induce a PHI in all reachable handlers.

Putting into Future for now as the bug is very old.

Activity

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 SuperPMIbugin-prThere is an active PR which will close this issue when it is merged

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions