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

Optimizations introduce null reference exception on latest preview 8 daily build #39403

Closed
RossNordby opened this issue Jul 16, 2020 · 2 comments · Fixed by #39424
Closed

Optimizations introduce null reference exception on latest preview 8 daily build #39403

RossNordby opened this issue Jul 16, 2020 · 2 comments · Fixed by #39424
Assignees
Labels
area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI bug
Milestone

Comments

@RossNordby
Copy link

RossNordby commented Jul 16, 2020

With tiered compilation off, optimizations enabled, targeting net5.0 on win10 x64 under latest daily build (f37dd6f, 5.0.0-preview.8.20361.2), calling TestRepro throws a null reference exception:

        struct Container
        {
            public Vector<int> Vector;
            public int Integer;
        }

        static Vector<int> DoAThingByRef(ref Vector<int> s)
        {
            return s + Vector<int>.Zero;
        }
        [MethodImpl(MethodImplOptions.NoInlining)]
        static unsafe Vector<int> Test()
        {
            Container container = default;
            return DoAThingByRef(ref container.Vector);
        }

        public static void TestRepro()
        {
            Test();
        }

The resulting assembly for Test:

 sub         rsp,28h  
 vzeroupper  
 xor         eax,eax  
 vxorps      xmm0,xmm0,xmm0  
 vmovdqu     xmmword ptr [rsp],xmm0  
 vmovdqu     xmmword ptr [rsp+10h],xmm0  
 mov         qword ptr [rsp+20h],rax  
 vxorps      ymm0,ymm0,ymm0  
 vpaddd      ymm0,ymm0,ymmword ptr [0] 🐱‍👤
 vmovupd     ymmword ptr [rcx],ymm0  
 mov         rax,rcx  
 vzeroupper  
 add         rsp,28h  
 ret  

Preview 7 works as expected.

@Dotnet-GitSync-Bot Dotnet-GitSync-Bot added area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI untriaged New issue has not been triaged by the area owner labels Jul 16, 2020
@AndyAyersMS
Copy link
Member

cc @dotnet/jit-contrib -- anyone want to take this?

@AndyAyersMS AndyAyersMS removed the untriaged New issue has not been triaged by the area owner label Jul 16, 2020
@AndyAyersMS AndyAyersMS added this to the 5.0.0 milestone Jul 16, 2020
@sandreenko sandreenko self-assigned this Jul 16, 2020
@sandreenko
Copy link
Contributor

sandreenko commented Jul 16, 2020

Thanks @RossNordby for testing daily builds and the detailed repro.

The problem was exposed by #38316, but it is a different from #39066, working on a fix.

@ghost ghost locked as resolved and limited conversation to collaborators Dec 8, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-CodeGen-coreclr CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants