git: 9front

Download patch

ref: 8920b13d4d4cdcaf3cd68072d99c052feb360952
parent: 77afdbbc121a19bbf2b7fa93b010d636780cd88a
author: spew <devnull@localhost>
date: Tue Mar 21 20:04:24 EDT 2017

[012568kqv]a: correctly lex full range of integers in the assemblers (thanks Ori_B)
The Plan 9 assemblers use strtoll to parse the integer literals
in their input. It turns out that this is almost correct, but
VLONG_MIN is clamped. This patch changes to use strtoull
in order to allow the full range of integers.

--- a/sys/src/cmd/cc/lexbody
+++ b/sys/src/cmd/cc/lexbody
@@ -343,9 +343,9 @@
 			goto casee;
 		*cp = 0;
 		if(sizeof(yylval.lval) == sizeof(vlong))
-			yylval.lval = strtoll(symb, nil, 10);
+			yylval.lval = strtoull(symb, nil, 10);
 		else
-			yylval.lval = strtol(symb, nil, 10);
+			yylval.lval = strtoul(symb, nil, 10);
 
 	ncu:
 		while(c == 'U' || c == 'u' || c == 'l' || c == 'L')
--