Skip to content

[netcore] Vector.CopyTo w/ LLVM emits wrong exception #16616

@filipnavara

Description

@filipnavara

Vector.CopyTo emits wrong exception for bounds check. Should be ArgumentOutOfRangeException, it throws System.IndexOutOfRangeException.

Output of MONO_ENV_OPTIONS="--llvm" make runtime run-tests-corefx-System.Numerics.Vectors.Tests:

    System.Numerics.Tests.GenericVectorTests.CopyToDouble [FAIL]
      Assert.Throws() Failure
      Expected: typeof(System.ArgumentOutOfRangeException)
      Actual:   typeof(System.IndexOutOfRangeException): Index was outside the bounds of the array.
      ---- System.IndexOutOfRangeException : Index was outside the bounds of the array.
      Stack Trace:
           at System.Numerics.Tests.GenericVectorTests.<>c__DisplayClass100_0`1[[System.Double, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51]].<TestCopyTo>b__1()
        ----- Inner Stack Trace -----
           at System.Numerics.Tests.GenericVectorTests.<>c__DisplayClass100_0`1[[System.Double, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51]].<TestCopyTo>b__1()
    System.Numerics.Tests.GenericVectorTests.CopyToUInt32 [FAIL]
      Assert.Throws() Failure
      Expected: typeof(System.ArgumentOutOfRangeException)
      Actual:   typeof(System.IndexOutOfRangeException): Index was outside the bounds of the array.
      ---- System.IndexOutOfRangeException : Index was outside the bounds of the array.
      Stack Trace:
           at System.Numerics.Tests.GenericVectorTests.<>c__DisplayClass100_0`1[[System.UInt32, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51]].<TestCopyTo>b__1()
        ----- Inner Stack Trace -----
           at System.Numerics.Tests.GenericVectorTests.<>c__DisplayClass100_0`1[[System.UInt32, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51]].<TestCopyTo>b__1()
    System.Numerics.Tests.GenericVectorTests.CopyToInt16 [FAIL]
      Assert.Throws() Failure
      Expected: typeof(System.ArgumentOutOfRangeException)
      Actual:   typeof(System.IndexOutOfRangeException): Index was outside the bounds of the array.
      ---- System.IndexOutOfRangeException : Index was outside the bounds of the array.
      Stack Trace:
           at System.Numerics.Tests.GenericVectorTests.<>c__DisplayClass100_0`1[[System.Int16, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51]].<TestCopyTo>b__1()
        ----- Inner Stack Trace -----
           at System.Numerics.Tests.GenericVectorTests.<>c__DisplayClass100_0`1[[System.Int16, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51]].<TestCopyTo>b__1()
    System.Numerics.Tests.GenericVectorTests.CopyToInt64 [FAIL]
      Assert.Throws() Failure
      Expected: typeof(System.ArgumentOutOfRangeException)
      Actual:   typeof(System.IndexOutOfRangeException): Index was outside the bounds of the array.
      ---- System.IndexOutOfRangeException : Index was outside the bounds of the array.
      Stack Trace:
           at System.Numerics.Tests.GenericVectorTests.<>c__DisplayClass100_0`1[[System.Int64, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51]].<TestCopyTo>b__1()
        ----- Inner Stack Trace -----
           at System.Numerics.Tests.GenericVectorTests.<>c__DisplayClass100_0`1[[System.Int64, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51]].<TestCopyTo>b__1()
    System.Numerics.Tests.GenericVectorTests.CopyToUInt64 [FAIL]
      Assert.Throws() Failure
      Expected: typeof(System.ArgumentOutOfRangeException)
      Actual:   typeof(System.IndexOutOfRangeException): Index was outside the bounds of the array.
      ---- System.IndexOutOfRangeException : Index was outside the bounds of the array.
      Stack Trace:
           at System.Numerics.Tests.GenericVectorTests.<>c__DisplayClass100_0`1[[System.UInt64, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51]].<TestCopyTo>b__1()
        ----- Inner Stack Trace -----
           at System.Numerics.Tests.GenericVectorTests.<>c__DisplayClass100_0`1[[System.UInt64, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51]].<TestCopyTo>b__1()
    System.Numerics.Tests.GenericVectorTests.CopyToSingle [FAIL]
      Assert.Throws() Failure
      Expected: typeof(System.ArgumentOutOfRangeException)
      Actual:   typeof(System.IndexOutOfRangeException): Index was outside the bounds of the array.
      ---- System.IndexOutOfRangeException : Index was outside the bounds of the array.
      Stack Trace:
           at System.Numerics.Tests.GenericVectorTests.<>c__DisplayClass100_0`1[[System.Single, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51]].<TestCopyTo>b__1()
        ----- Inner Stack Trace -----
           at System.Numerics.Tests.GenericVectorTests.<>c__DisplayClass100_0`1[[System.Single, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51]].<TestCopyTo>b__1()
    System.Numerics.Tests.GenericVectorTests.CopyToByte [FAIL]
      Assert.Throws() Failure
      Expected: typeof(System.ArgumentOutOfRangeException)
      Actual:   typeof(System.IndexOutOfRangeException): Index was outside the bounds of the array.
      ---- System.IndexOutOfRangeException : Index was outside the bounds of the array.
      Stack Trace:
           at System.Numerics.Tests.GenericVectorTests.<>c__DisplayClass100_0`1[[System.Byte, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51]].<TestCopyTo>b__1()
        ----- Inner Stack Trace -----
           at System.Numerics.Tests.GenericVectorTests.<>c__DisplayClass100_0`1[[System.Byte, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51]].<TestCopyTo>b__1()
    System.Numerics.Tests.GenericVectorTests.CopyToSByte [FAIL]
      Assert.Throws() Failure
      Expected: typeof(System.ArgumentOutOfRangeException)
      Actual:   typeof(System.IndexOutOfRangeException): Index was outside the bounds of the array.
      ---- System.IndexOutOfRangeException : Index was outside the bounds of the array.
      Stack Trace:
           at System.Numerics.Tests.GenericVectorTests.<>c__DisplayClass100_0`1[[System.SByte, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51]].<TestCopyTo>b__1()
        ----- Inner Stack Trace -----
           at System.Numerics.Tests.GenericVectorTests.<>c__DisplayClass100_0`1[[System.SByte, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51]].<TestCopyTo>b__1()
    System.Numerics.Tests.GenericVectorTests.CopyToInt32 [FAIL]
      Assert.Throws() Failure
      Expected: typeof(System.ArgumentOutOfRangeException)
      Actual:   typeof(System.IndexOutOfRangeException): Index was outside the bounds of the array.
      ---- System.IndexOutOfRangeException : Index was outside the bounds of the array.
      Stack Trace:
           at System.Numerics.Tests.GenericVectorTests.<>c__DisplayClass100_0`1[[System.Int32, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51]].<TestCopyTo>b__1()
        ----- Inner Stack Trace -----
           at System.Numerics.Tests.GenericVectorTests.<>c__DisplayClass100_0`1[[System.Int32, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51]].<TestCopyTo>b__1()
    System.Numerics.Tests.GenericVectorTests.CopyToUInt16 [FAIL]
      Assert.Throws() Failure
      Expected: typeof(System.ArgumentOutOfRangeException)
      Actual:   typeof(System.IndexOutOfRangeException): Index was outside the bounds of the array.
      ---- System.IndexOutOfRangeException : Index was outside the bounds of the array.
      Stack Trace:
           at System.Numerics.Tests.GenericVectorTests.<>c__DisplayClass100_0`1[[System.UInt16, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51]].<TestCopyTo>b__1()
        ----- Inner Stack Trace -----
           at System.Numerics.Tests.GenericVectorTests.<>c__DisplayClass100_0`1[[System.UInt16, System.Private.CoreLib, Version=5.0.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51]].<TestCopyTo>b__1()
  Finished:    System.Numerics.Vectors.Tests

/cc @vargaz

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions