shithub: riscv

Download patch

ref: 8b6621a36032d2ff8b98ce89f995c8277aeb935f
parent: 3309f05b976c5f18bde1383f007b01025db31fce
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')