summaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorJo-Philipp Wich <jo@mein.io>2021-09-19 19:36:44 +0200
committerJo-Philipp Wich <jo@mein.io>2021-09-19 19:37:30 +0200
commite55188bb8bba50e7518a7d95c680cc46607eb24f (patch)
tree44c75028effef0d8809d886e7fa09bb01801cecc /tests
parent98c4147ec8c5ec077994d6d7ea5823a9adbad441 (diff)
compiler: properly handle jumps to offset 0
When compiling certain expressions as first statement of an ucode program, e.g. a while loop in raw mode, a jump instruction to offset zero is emitted which was incorrectly treated as placeholder by the compiler. Signed-off-by: Jo-Philipp Wich <jo@mein.io>
Diffstat (limited to 'tests')
-rw-r--r--tests/custom/03_bugs/26_compiler_jmp_to_zero17
1 files changed, 17 insertions, 0 deletions
diff --git a/tests/custom/03_bugs/26_compiler_jmp_to_zero b/tests/custom/03_bugs/26_compiler_jmp_to_zero
new file mode 100644
index 0000000..e7e0127
--- /dev/null
+++ b/tests/custom/03_bugs/26_compiler_jmp_to_zero
@@ -0,0 +1,17 @@
+When compiling certain expressions as first statement of an ucode
+program, e.g. a while loop in raw mode, a jump instruction to offset
+zero is emitted which was incorrectly treated as placeholder by the
+compiler.
+
+-- Testcase --
+while (i++ < 1)
+ print("Test\n");
+-- End --
+
+-- Args --
+-R
+-- End --
+
+-- Expect stdout --
+Test
+-- End --