summaryrefslogtreecommitdiffhomepage
path: root/tests/03_bugs/10_break_stack_mismatch
diff options
context:
space:
mode:
authorPetr Štetiar <ynezz@true.cz>2021-03-19 16:54:55 +0100
committerJo-Philipp Wich <jo@mein.io>2021-04-23 00:42:30 +0200
commit2b59097c3f61fa901e91ac4cea48940760439578 (patch)
tree958d739a78f959dfcd55b3d76e6e970ca53fa1c6 /tests/03_bugs/10_break_stack_mismatch
parent80393611fb6634abcc0da1dee2da7c4418dbde8d (diff)
tests: create custom tests from current tests cases
Signed-off-by: Petr Štetiar <ynezz@true.cz>
Diffstat (limited to 'tests/03_bugs/10_break_stack_mismatch')
-rw-r--r--tests/03_bugs/10_break_stack_mismatch38
1 files changed, 0 insertions, 38 deletions
diff --git a/tests/03_bugs/10_break_stack_mismatch b/tests/03_bugs/10_break_stack_mismatch
deleted file mode 100644
index ae16dac..0000000
--- a/tests/03_bugs/10_break_stack_mismatch
+++ /dev/null
@@ -1,38 +0,0 @@
-When emitting jump instructions for breaking out of for-loops, the compiler
-incorrectly set the jump target before the pop instruction clearing the
-intermediate loop variables. Since the break instruction itself already
-compiles to a series of pop instructions reverting the stack to it's the
-pre-loop state, intermediate values got popped twice, leading to a stack
-layout mismatch between compiler and VM, resulting in wrong local variable
-values or segmentation faults at runtime.
-
--- Testcase --
-{%
- let x = 1;
-
- for (let y in [2])
- break;
-
- print(x, "\n");
-%}
--- End --
-
--- Expect stdout --
-1
--- End --
-
-
--- Testcase --
-{%
- let x = 1;
-
- for (let y = 0; y < 1; y++)
- break;
-
- print(x, "\n");
-%}
--- End --
-
--- Expect stdout --
-1
--- End --