From b7b03ee4510f1dd3f8b7dfdbe4a21d5c0d9bfeb2 Mon Sep 17 00:00:00 2001 From: ISSOtm Date: Tue, 18 Aug 2020 12:34:05 +0200 Subject: [PATCH] Fix "REPT 0" not being a no-op --- src/asm/fstack.c | 2 ++ test/asm/rept-0.asm | 3 +++ test/asm/rept-0.err | 0 test/asm/rept-0.out | 0 4 files changed, 5 insertions(+) create mode 100644 test/asm/rept-0.asm create mode 100644 test/asm/rept-0.err create mode 100644 test/asm/rept-0.out diff --git a/src/asm/fstack.c b/src/asm/fstack.c index c1f8a084..0a8cf5f1 100644 --- a/src/asm/fstack.c +++ b/src/asm/fstack.c @@ -258,6 +258,8 @@ void fstk_RunRept(uint32_t count, int32_t nReptLineNo, char *body, size_t size) { dbgPrint("Running REPT(%" PRIu32 ")\n", count); + if (count == 0) + return; uint32_t reptDepth = contextStack->reptDepth; newContext(reptDepth + 1); diff --git a/test/asm/rept-0.asm b/test/asm/rept-0.asm new file mode 100644 index 00000000..13a52a69 --- /dev/null +++ b/test/asm/rept-0.asm @@ -0,0 +1,3 @@ +REPT 0 + WARN "2" +ENDR diff --git a/test/asm/rept-0.err b/test/asm/rept-0.err new file mode 100644 index 00000000..e69de29b diff --git a/test/asm/rept-0.out b/test/asm/rept-0.out new file mode 100644 index 00000000..e69de29b