summaryrefslogtreecommitdiff
path: root/parse
diff options
context:
space:
mode:
Diffstat (limited to 'parse')
-rw-r--r--parse/infer.c20
-rw-r--r--parse/tok.c5
2 files changed, 15 insertions, 10 deletions
diff --git a/parse/infer.c b/parse/infer.c
index ba5509d..79e45cf 100644
--- a/parse/infer.c
+++ b/parse/infer.c
@@ -2570,22 +2570,22 @@ checkrange(Node *n)
int64_t sval;
uint64_t uval;
static const int64_t svranges[][2] = {
- /* signed ints */
- [Tyint8] = {-128LL, 127LL},
- [Tyint16] = {-32768LL, 32767LL},
- [Tyint32] = {-2147483648LL, 2147483647LL},
- [Tyint] = {-2147483648LL, 2147483647LL},
- [Tyint64] = {-9223372036854775808ULL, 9223372036854775807LL},
+ /* signed ints; allow one above max range for unary -'ve operator */
+ [Tyint8] = {-128LL, 128LL},
+ [Tyint16] = {-32768LL, 32768LL},
+ [Tyint32] = {-2147483648LL, 2147483648LL},
+ [Tyint] = {-2147483648LL, 2147483648LL},
+ [Tyint64] = {-9223372036854775808ULL, 9223372036854775807ULL},
};
static const uint64_t uvranges[][2] = {
- [Tybyte] = {0, 255ULL},
- [Tyuint8] = {0, 255ULL},
+ [Tybyte] = {0, 255ULL},
+ [Tyuint8] = {0, 255ULL},
[Tyuint16] = {0, 65535ULL},
- [Tyuint] = {0, 4294967295ULL},
+ [Tyuint] = {0, 4294967295ULL},
[Tyuint32] = {0, 4294967295ULL},
[Tyuint64] = {0, 18446744073709551615ULL},
- [Tychar] = {0, 4294967295ULL},
+ [Tychar] = {0, 4294967295ULL},
};
/* signed types */
diff --git a/parse/tok.c b/parse/tok.c
index f4505d5..8b40dc2 100644
--- a/parse/tok.c
+++ b/parse/tok.c
@@ -732,12 +732,14 @@ nextsuffix
:
switch (peek()) {
case 'u':
+ case 'U':
if (unsignedval == 1)
lfatal(curloc, "Duplicate 'u' integer specifier");
next();
unsignedval = 1;
goto nextsuffix;
case 'l':
+ case 'L':
next();
if (unsignedval)
t->inttype = Tyuint64;
@@ -745,6 +747,7 @@ nextsuffix
t->inttype = Tyint64;
break;
case 'i':
+ case 'I':
next();
if (unsignedval)
t->inttype = Tyuint32;
@@ -752,6 +755,7 @@ nextsuffix
t->inttype = Tyint32;
break;
case 's':
+ case 'S':
next();
if (unsignedval)
t->inttype = Tyuint16;
@@ -759,6 +763,7 @@ nextsuffix
t->inttype = Tyint16;
break;
case 'b':
+ case 'B':
next();
if (unsignedval)
t->inttype = Tyuint8;