Int64 indices are silently truncated when used to access MD array elements #30648
Labels
Area-Compilers
Bug
help wanted
The issue is "up for grabs" - add a comment if you are interested in working on it
Milestone
The following code should produce an exception (
IndexOutOfRangeException
butOverflowException
would do too I guess) but it does not:The generated IL code is:
The spec appears to be silent about this case. From the generated code it looks like the intention was to handle this case by using a checked cast, the same is done with SZ arrays.
There must have been some confusion with
ldelem
. That one accepts bothint32
andnative int
but MD array accessors support onlyint32
indices and passing anative int
argument in this case would result in silent truncation. Thatconv.ovf.i
should really beconv.ovf.i4
.Reproduced with VS 15.8.7 but I'd guess that the problem is much older.
The text was updated successfully, but these errors were encountered: