-
Notifications
You must be signed in to change notification settings - Fork 6k
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
Inconsistent treatment of constants by static analysis and constant evaluation #15709
Comments
This has been distilled out of #15600 where the current behaviour of constant evaluation causes SMTChecker to crash. |
The only reason it causes a crash is the fact that it does not report a fatal error properly. An exception is thrown but the error is not added to the error reporter. It would be just an ordinary compilation error. This needs to be fixed as well. Though to be fair, this separate bug in error handling is probably the only reason this odd case was discovered :) |
I investigated this and it's a clusterfuck of several small bugs. 1.
|
We discussed it on the call today. A proper fix for handling constants in There are some things we should do immediately:
In the longer term (unless we get #3157 by then) we may also:
On the other hand we can live with errors in cases that would revert at runtime anyway (i.e. overflows and underflows). |
Description
The compiler exhibits an inconsistent treatment of constant expressions evaluation.
When applying bitwise negation on uint256 max value (
0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
), the compiler reports error for some expressions, but does not report an error in others.When the expression appears as part of division, an error is reported.
Error reported:
However, when the expression stands on its own, no error is reported.
Note that if the definition is inlined and the bitwise negation is applied directly to a literal a conversion error is reported:
The text was updated successfully, but these errors were encountered: