shithub: riscv

Download patch

ref: b9adc507d25ec5f41463d31ef54751c1180c3db2
parent: dadaeb584bfec1315561edf3a3470205725de7eb
author: Michael Forney <mforney@mforney.org>
date: Sat Jan 22 20:05:27 EST 2022

cc: fix incorrect octal range condition in mpatov

This does not have any adverse effect, since yylex never calls mpatov
with a string with leading 0 (and not 0x) that contains non-octal
digits, but the condition was wrong regardless.

--- a/sys/src/cmd/cc/lex.c
+++ b/sys/src/cmd/cc/lex.c
@@ -982,7 +982,7 @@
 	if(c == 'x' || c == 'X')
 		goto hex;
 	while(c = *s++) {
-		if(c >= '0' || c <= '7')
+		if(c >= '0' && c <= '7')
 			nn = n*8 + c-'0';
 		else
 			goto bad;