commit 91c841038b2cc8dcd84bd6dc6415453062e245b5
parent db3fcecc66333bd273a847cad7a78e87a3628260
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Wed, 11 May 2016 11:54:29 +0200
[cc1] Fix lower case hexadecimal numbers
We were using the strchr approach to convert from a hexadecimal
number to a quantity, but we only had upper case digits in our
array, so something like 0x7fff will generate a very weird number
Diffstat:
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/cc1/lex.c b/cc1/lex.c
@@ -274,7 +274,7 @@ readint(char *s, int base, int sign, Symbol *sym)
for (u = 0; isxdigit(c = *s++); u = u*base + val) {
static char letters[] = "0123456789ABCDEF";
- val = strchr(letters, c) - letters;
+ val = strchr(letters, toupper(c)) - letters;
repeat:
if (u <= max/base && u*base <= max - val)
continue;