-
Notifications
You must be signed in to change notification settings - Fork 258
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
Fix on missing warning on some cases of integer literal coercion #5728 #6510
base: master
Are you sure you want to change the base?
Fix on missing warning on some cases of integer literal coercion #5728 #6510
Conversation
0546a8d
to
ba80845
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you add a test?
I am not sure I understand what is being fixed here. We don’t want a warning for int64_t v = -9223372036854775808 and I am not seeing how the patch fixes that.
It is fixing the issues reported:
|
I am just seeing the comment being deleted is discussing this case, so it is best to verify things are working as expected with tests. |
ba80845
to
96c3384
Compare
I have the test added for the integer literal coercion. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Change looks good to me.
Fix misisng warnings on: int x3 = 18446744073709551615; int x4 = 0xFFFFFFFFFFFFFFFF; Add test cases for the integer literal coercion
96c3384
to
c557cc2
Compare
The fundamental problem of this issue is that we are trying to determine the type of a literal or issue a warning too early. When we parse the int literal, we just store the token into the AST, and parse the int into a uint64_t field. Let's not determine the type of the literal expr yet. Then when we are checking the expr in SemanticExprVisitor, we can always fold the |
Fix missing warnings on:
int x3 = 18446744073709551615;
int x4 = 0xFFFFFFFFFFFFFFFF;
fixes #5728