Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JIT: Inliner direct substitution of return buffers can reorder side effects #112053

Closed
jakobbotsch opened this issue Jan 31, 2025 · 6 comments · May be fixed by #112010
Closed

JIT: Inliner direct substitution of return buffers can reorder side effects #112053

jakobbotsch opened this issue Jan 31, 2025 · 6 comments · May be fixed by #112010
Assignees
Labels
area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI in-pr There is an active PR which will close this issue when it is merged
Milestone

Comments

@jakobbotsch
Copy link
Member

jakobbotsch commented Jan 31, 2025

The following program throws DivideByZeroException when optimizing and NullReferenceException otherwise. The correct exception is DivideByZeroException.

using System;
using System.Runtime.CompilerServices;

public unsafe class Program
{
    public static void Main()
    {
        Foo(null, 0);
    }

    [MethodImpl(MethodImplOptions.NoInlining)]
    private static void Foo(C c, int x)
    {
        c.G = Test(1 / x);
    }

    public static Guid Test(int x)
    {
        return new Guid(x, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
    }

    class C
    {
        public Guid G;
    }
}
@dotnet-issue-labeler dotnet-issue-labeler bot added the area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI label Jan 31, 2025
@dotnet-policy-service dotnet-policy-service bot added the untriaged New issue has not been triaged by the area owner label Jan 31, 2025
Copy link
Contributor

Tagging subscribers to this area: @JulieLeeMSFT, @jakobbotsch
See info in area-owners.md if you want to be subscribed.

@jakobbotsch jakobbotsch removed the untriaged New issue has not been triaged by the area owner label Jan 31, 2025
@jakobbotsch jakobbotsch self-assigned this Jan 31, 2025
@jakobbotsch jakobbotsch added this to the 10.0.0 milestone Jan 31, 2025
@dotnet-policy-service dotnet-policy-service bot added the in-pr There is an active PR which will close this issue when it is merged label Jan 31, 2025
@SingleAccretion
Copy link
Contributor

Also linking #77650.

@jakobbotsch
Copy link
Member Author

Ah, thanks! I'm going to close #77650 as the duplicate here since I already added a test pointing to this issue in #112010.

@jakobbotsch
Copy link
Member Author

Actually given that there is already discussion in that issue I will just rename the test.

Duplicate of #77650

@jakobbotsch
Copy link
Member Author

Maybe not :-) Looks like these are different issues. Probably #77650 and #72323 are actually the same issue

@jakobbotsch
Copy link
Member Author

I will close this as a duplicate of #77650. It's hard to come up with a test case that fails because of the inliner substitution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI in-pr There is an active PR which will close this issue when it is merged
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants