Runtime: Simple Vector4 code leads to AccessViolationException when Optimization is disabled

Created on 28 Oct 2018  路  5Comments  路  Source: dotnet/runtime

The code below leads to exception if compiled with Optimization disabled. (AccessViolationException in Debug NullReferenceException (!?) in Release). Seems reproducible with any official version of RyuJIT.

```C#
using System.Numerics;

namespace JitBugRepro
{
class Program
{
static void Main(string[] args)
{
var vector = new Vector4();
Oops(vector);
}

    private static readonly Vector4 Noo = new Vector4();

    public static Vector4 Oops(Vector4 v)
    {
        v.W = 1f;

        return v + Noo;
    }
}

}

```

/cc @CarolEidt

All 5 comments

I can reproduce this in .NET Core 2.1 but not in the current master build, I suppose this was already fixed.

If already fixed, it might make sense to add a regression test. (If not yet present.)

Are we sure this is fixed? I found an array case that throws the same error (again only if optimizations are disabled) so i was wondering if this was related or just co-incindentally similar symptoms.

Also I'm guessing I posted it to the wrong repo when posting it to the dotnet/core rather than here.
https://github.com/dotnet/core/issues/2094

Verified that this was fixed with dotnet/coreclr#19857 and added test in dotnet/coreclr#21567

Was this page helpful?
0 / 5 - 0 ratings