source: tests/ctrl-flow/goto.cfa @ 82ff201a

Last change on this file since 82ff201a was b6923b17, checked in by Andrew Beach <ajbeach@…>, 4 months ago

Fixed goto labelled loop. I had to reorder some passes. Updated control declaration hoisting (including comments and correcting update count). Added test, moved more tests into ctrl-flow.

  • Property mode set to 100644
File size: 355 bytes
Line 
1// Some runtime tests for goto.
2
3#include <fstream.hfa>
4
5// Make sure loop hoisting
6void gotoLabelledLoop() {
7        sout | "goto-loop";
8        goto label;
9        sout | "!";
10
11        // Verbose loop will lead to lifting.
12        label: for (int i = 0 ; i < 2 ; ++i) {
13                sout | "loop";
14        }
15        sout | "end" | nl;
16}
17
18int main(int argc, char * argv[]) {
19        sout | nlOff;
20
21        gotoLabelledLoop();
22}
Note: See TracBrowser for help on using the repository browser.