Skip to content

A static goto inside a block literal leaves the block instead of reaching its label #4476

Closed

Description

@borisbat

On master (5b4d440), interpreter:

options gen2
[sideeffects]
def lab2 : int {
    var q = 0
    let v = invoke($() : int {
        goto label 3
        label 3:
        return 3
    })
    return v + q
}
[export]
def main {
    print("{lab2()}\n")
}

Expected 3. Got EXCEPTION: end of block without return - the jump leaves the block literal instead of reaching the label two lines down. A label without a goto in the same literal (invoke($() : int { label 3: return 3 })) runs, and a computed goto whose target is a label only a block literal declares throws as it should (jump to label 3 failed, caught by a try around the call).

Activity

  1. changed the title [-]A label inside a block literal: a static goto leaves the block, a computed goto beside one crashes simulate[/-] [+]A static goto inside a block literal leaves the block instead of reaching its label[/+] on Nov 7, 2026
  2. added a commit that references this issue on Nov 8, 2026
    50ddda4
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions