Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

checked does not handle the -x operation. #1175

Open
nan01ab opened this issue Sep 20, 2024 · 5 comments
Open

checked does not handle the -x operation. #1175

nan01ab opened this issue Sep 20, 2024 · 5 comments
Assignees
Labels

Comments

@nan01ab
Copy link
Contributor

nan01ab commented Sep 20, 2024

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);
}
@Jim8y
Copy link
Contributor

Jim8y commented Sep 20, 2024

This apparently a compiler bug, please fix it.

@Hecate2
Copy link
Contributor

Hecate2 commented Nov 21, 2024

Better to merge #1205 first

@Hecate2
Copy link
Contributor

Hecate2 commented Dec 12, 2024

#1205 was closed. Maybe it's time to handle many potential problems in simulating overflow.

@Hecate2
Copy link
Contributor

Hecate2 commented Dec 12, 2024

"/" => (OpCode.DIV, false),
int.MinValue / (-1) ?

@nan01ab
Copy link
Contributor Author

nan01ab commented Dec 12, 2024

"/" => (OpCode.DIV, false), int.MinValue / (-1) ?

Yes, this also needs to be checked.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants