Can `conv.ovf.u8.un` throw `OverflowException`?

Viewed 57

I am working on an interpreter of CIL and came across conv.ovf.u8.un.

Making a test, I realized that even if 0xffffffffffffffff is on the stack, conv.ovf.u8.un still doesn't throw OverflowException.

The following code:

ldc.i8 0xffffffffffffffff
conv.ovf.u8.un
box [mscorlib]System.UIntPtr
callvirt instance string [mscorlib]System.Object::ToString()
call void [mscorlib]System.Console::WriteLine(string)

works well, without an exception.

In general, it seems to be expected. But the ECMA-335 says:

Convert unsigned to an unsigned int64 (on the stack as int64) and throw an exception on overflow.

That's why I decided to ask the community whether a case when conv.ovf.u8.un throws OverflowException.

0 Answers
Related