This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/52661] negative maxint for long long gives warning
- From: "pinskia at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Thu, 22 Mar 2012 20:54:17 +0000
- Subject: [Bug c/52661] negative maxint for long long gives warning
- Auto-submitted: auto-generated
- References: <bug-52661-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52661
--- Comment #13 from Andrew Pinski <pinskia at gcc dot gnu.org> 2012-03-22 20:54:17 UTC ---
First off take:
9223372036854775808LL
It is too large to fit into a signed long long so it is assumed as unsigned.
That is what the warning is about.
What you have is:
- 9223372036854775808LL
So the parser comes along and see - and then 9223372036854775808LL as separate
tokens. It is not warning that the value "-9223372036854775808" is too large
but rather just "9223372036854775808LL" is too large.
So basically this comes down to there are two separate tokens.
Please reread my comments, they have been saying the same thing a couple of
different ways. Basically the negative sign is not part of the number token.
This is on purpose to make tokenizer simpler and not need extra info from the
context around it.
like:
a -9223372036854775808LL.
THis is tokenized as three tokens, not two. It would be hard to do some
parsing if it was tokenized as two, the tokenizer would need feedback from the
parser itself. That would make the C/C++ really more complex then they are
currently.