-
-
Notifications
You must be signed in to change notification settings - Fork 836
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
as_num256 failed to reject negative arguments #469
Labels
bug
Bug that shouldn't change language semantics when fixed.
Comments
Merged
Totally on board with this. Does a runtime error get generated when |
@fubuloubu Yep,
error:
|
Fantastic! Is there a test like that? Haha |
E.g. But like use really big numbers for 1, 2, and 3 |
in which file num256_sub() is defined? |
@Dishendramishra All |
@daejunpark Thanks for making an issue, this has been fixed. Closing. |
# for free
to join this conversation on GitHub.
Already have an account?
# to comment
What's your issue about?
AFAIU,
as_num256(x)
should not be allowed whenx < 0
. If so, the compiler should reject at compile-time as much as possible, or insert runtime check to throw a runtime exception. However, the current compiler does not generate the runtime check even if it cannot provex >= 0
.For example,
foo()
returns2**256 - 1
:while this:
failed to be parsed:
Similarly,
bar(-1)
returns2**256 - 1
:How can it be fixed?
For each
as_num256(x)
, generate runtime-checkassert(x >= 0)
whenx >= 0
cannot be proved at compile-time.Cute Animal Picture
The text was updated successfully, but these errors were encountered: