shithub: scc

Download patch

ref: bd868e6e88690ee8521e3c3738f908b6557a1ac1
parent: 94dc2642c6fd8ed6f2b34bde20a22339258216ca
author: Roberto E. Vargas Caballero <[email protected]>
date: Sat Sep 9 03:33:20 EDT 2017

[as] Allow instructions without arguments

In that case the argument string is NULL and as was segfaulting.

--- a/as/main.c
+++ b/as/main.c
@@ -63,7 +63,7 @@
 	Arg *ap;
 	static Arg args[NARGS];
 
-	for (ap = args; ; ++ap) {
+	for (ap = args; s; ++ap) {
 		while (isspace(*s))
 			++s;
 		if (*s == '\0')
--- a/as/target/x86/gen.awk
+++ b/as/target/x86/gen.awk
@@ -72,7 +72,7 @@
 		a = substr(a, RLENGTH+1)
 		if (a ~ /^\+$/) {
 			return out "|AREP"
-		} else {
+		} else if (a != "") {
 			print "wrong arg", a
 			exit 1
 		}