Skip to content

Segfault in combination with match #9583

@tsteckenborn

Description

@tsteckenborn

Given e.g.

# Scenario:
# A byte parser classifies the length of a fixed-width fragment, such as the
# digits after the dot in a time fraction. The top-level expect only calls the
# default branch with an empty list, but compiling seven consecutive fixed-length
# list patterns is enough to crash `roc test --no-cache` on roc_nightly-macos_apple_silicon-2026-06-01-b250321.

Repro := {}.{

fractionDigitWidth : List(U8) -> I64
fractionDigitWidth = |fractionBytes| {
    match fractionBytes {
        [_firstDigit] => 1
        [_firstDigit, _secondDigit] => 2
        [_firstDigit, _secondDigit, _thirdDigit] => 3
        [_firstDigit, _secondDigit, _thirdDigit, _fourthDigit] => 4
        [_firstDigit, _secondDigit, _thirdDigit, _fourthDigit, _fifthDigit] => 5
        [_firstDigit, _secondDigit, _thirdDigit, _fourthDigit, _fifthDigit, _sixthDigit] => 6
        [_firstDigit, _secondDigit, _thirdDigit, _fourthDigit, _fifthDigit, _sixthDigit, _seventhDigit] => 7
        _ => 0
    }
}
}

expect {
    fractionDigitWidth([]) == 0
}

roc test reports a SIGSEGV.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No fields configured for Bug.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions