| 1 | # test various forms of goto | ||
| 2 | |||
| 3 | # simple in-line goto | ||
| 4 | |||
| 5 | 16 | goto main_label; | |
| 6 | 0 | die "should not get here"; | |
| 7 | 16 | main_label:; | |
| 8 | |||
| 9 | 16 | ▶ | sub other { } # stub for checking sub caller info |
|
Subroutine
other: called CC=1 SCAR=0.0
| |||
| 10 | |||
| 11 | # goto &sub | ||
| 12 | |||
| 13 | 16 | ▶ | sub origin { |
|
Subroutine
origin: called CC=1 SCAR=0.0
| |||
| 14 | 16 | other(); | |
| 15 | 16 | goto &destination; | |
| 16 | } | ||
| 17 | |||
| 18 | 16 | ▶ | sub destination { |
|
Subroutine
destination: called CC=1 SCAR=0.0
| |||
| 19 | 16 | other(); | |
| 20 | } | ||
| 21 | |||
| 22 | 16 | origin(); | |
| 23 | |||
| 24 | # goto out of a sub | ||
| 25 | |||
| 26 | 16 | ▶ | sub bar { |
|
Subroutine
bar: called CC=1 SCAR=0.0
| |||
| 27 | 16 | goto foo_label; | |
| 28 | } | ||
| 29 | |||
| 30 | 16 | ▶ | sub foo { |
|
Subroutine
foo: called CC=1 SCAR=0.0
| |||
| 31 | 16 | bar(); | |
| 32 | foo_label:; | ||
| 33 | } | ||
| 34 | |||
| 35 | 16 | foo(); | |