`checked` does not handle the `-x` operation.
In inc operation, Neo-VM script and standard C# program will throw an Exception both if src overflowed:
public static int Inc(int src)
{
return checked(++src);
}
In -x operation, standard C# program will throw an Exception if src overflowed(src is -2147483648), but Neo-VM script not:
public static int Negative(int src)
{
return checked(-src);
}
This apparently a compiler bug, please fix it.
Better to merge https://github.com/neo-project/neo-devpack-dotnet/pull/1205 first
https://github.com/neo-project/neo-devpack-dotnet/pull/1205 was closed. Maybe it's time to handle many potential problems in simulating overflow.
"/" => (OpCode.DIV, false),
int.MinValue / (-1) ?
"/" => (OpCode.DIV, false),int.MinValue / (-1) ?
Yes, this also needs to be checked.