summaryrefslogtreecommitdiffhomepage
path: root/tests/custom/99_bugs/39_compiler_switch_continue_mismatch
blob: c9b9ec64a3b969569a1e5bd0b56f545d2dcaa90c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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 --