summaryrefslogtreecommitdiffhomepage
path: root/tests/custom/04_bugs
diff options
context:
space:
mode:
Diffstat (limited to 'tests/custom/04_bugs')
-rw-r--r--tests/custom/04_bugs/39_compiler_switch_continue_mismatch31
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/custom/04_bugs/39_compiler_switch_continue_mismatch b/tests/custom/04_bugs/39_compiler_switch_continue_mismatch
new file mode 100644
index 0000000..c9b9ec6
--- /dev/null
+++ b/tests/custom/04_bugs/39_compiler_switch_continue_mismatch
@@ -0,0 +1,31 @@
+When compiling continue statements nested in switches, the compiler only
+emitted pop statements for the local variables in the switch body scope,
+but not for the locals in the scope(s) leading up to the containing loop
+body.
+
+Depending on the context, this either led to infinite loops, wrong local
+variable values or segmentation faults.
+
+-- Testcase --
+{%
+ let n = 0;
+
+ while (true) {
+ let x = 1;
+
+ switch (n++) {
+ case 0:
+ case 1:
+ continue;
+ }
+
+ break;
+ }
+
+ print(n, '\n');
+%}
+-- End --
+
+-- Expect stdout --
+3
+-- End --