shithub: scc

Download patch

ref: 1fc4bd2a74431fc24c7c4dad51c67205044348aa
parent: 7c1c6de3c313bcc6d9b460735e37961426c28783
author: Roberto E. Vargas Caballero <k0ga@shike2.com>
date: Wed May 11 07:54:29 EDT 2016

[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

--- a/cc1/lex.c
+++ b/cc1/lex.c
@@ -274,7 +274,7 @@
 
 	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;