scc

Simple C99 Compiler
Log | Files | Refs | README | LICENSE

commit 2883d0179563960dacbe4c97ec78f3822aca7c29
parent a71f0ed6bf7bac612633c2c2b745d6bf2b45d314
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date:   Wed,  7 Oct 2015 12:36:51 +0200

Fix conversion of hexadecimal constants

It is possible to have upper case or lower case letters in
hexadecimal numbers, and the expression was only valid
for upper case.

Diffstat:
cc1/lex.c | 2+-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/cc1/lex.c b/cc1/lex.c @@ -273,7 +273,7 @@ readint(char *s, int base, int sign, Symbol *sym) ++s; for (u = 0; isxdigit(c = *s++); u = u*base + val) { - val = (c <= '9') ? c - '0' : 10 + c - 'A'; + val = (c <= '9') ? c - '0' : 10 + toupper(c) - 'A'; repeat: if (u <= max/base && u*base <= max - val) continue;