commit 7d178752ef2032277b760b3b7d70956698938a18
parent 9e267438dbc681f048234dc5e34317877bdf17c3
Author: Roberto E. Vargas Caballero <k0ga@shike2.com>
Date: Sat, 9 Sep 2017 07:33:20 +0200
[as] Allow instructions without arguments
In that case the argument string is NULL and as was segfaulting.
Diffstat:
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/as/main.c b/as/main.c
@@ -63,7 +63,7 @@ getargs(char *s)
Arg *ap;
static Arg args[NARGS];
- for (ap = args; ; ++ap) {
+ for (ap = args; s; ++ap) {
while (isspace(*s))
++s;
if (*s == '\0')
diff --git a/as/target/x86/gen.awk b/as/target/x86/gen.awk
@@ -72,7 +72,7 @@ function str2args(s, args, i, out)
a = substr(a, RLENGTH+1)
if (a ~ /^\+$/) {
return out "|AREP"
- } else {
+ } else if (a != "") {
print "wrong arg", a
exit 1
}