The compiler segfaults instead of reporting an error when an lpipe() trailing-block statement follows a return that already consumed a trailing block.
Repro
options gen2
require daslib/lpipe
def two_blocks(a : block<() : int>; b : block<() : int>) : int {
return invoke(a) + invoke(b)
}
def go() : int {
return two_blocks() {
return 1
}
lpipe() {
return 2
}
}
[export] def main() {
print("{go()}\n")
}
$ bin/daslang lpipe_crash.das
CRASH: SIGSEGV (Segmentation fault) (signal 11)
(core dumped)
Interpreter, no flags, no JIT. Compile-time crash — the program never runs.
Expected
A diagnostic. The input is malformed: two_blocks takes two blocks, the return supplies one as a trailing block, and the lpipe() that was meant to supply the second is stranded after the return as its own statement. The correct spelling assigns first, then pipes the second block, then returns:
var r = two_blocks() {
return 1
}
lpipe() {
return 2
}
return r
That version compiles and runs. Only the return-first form crashes.
Affects master
Verified on a build with no local modifications. The checkout it was built from differs from origin/master only in daslib/ast_verify.das and some utils/ast-fuzz/ test files; src/, include/, modules/ and daslib/lpipe.das are byte-identical to master, and ast_verify only runs under --ast-verify, which this repro does not pass.
How it was hit
Writing an emitter change in modules/dasLLVM/daslib/llvm_jit.das, by mis-spelling the two-block build_select(...) { ... } lpipe() { ... } idiom as return build_select(...) { ... } followed by lpipe() { ... }. A crash rather than an error makes that typo needlessly expensive to find — daslang utils/lint/main.das -- <file> also dies, so the usual check gives no clue either.
Environment
Linux, clang 20.1.2, Release build.
The compiler segfaults instead of reporting an error when an
lpipe()trailing-block statement follows areturnthat already consumed a trailing block.Repro
Interpreter, no flags, no JIT. Compile-time crash — the program never runs.
Expected
A diagnostic. The input is malformed:
two_blockstakes two blocks, thereturnsupplies one as a trailing block, and thelpipe()that was meant to supply the second is stranded after thereturnas its own statement. The correct spelling assigns first, then pipes the second block, then returns:That version compiles and runs. Only the
return-first form crashes.Affects master
Verified on a build with no local modifications. The checkout it was built from differs from
origin/masteronly indaslib/ast_verify.dasand someutils/ast-fuzz/test files;src/,include/,modules/anddaslib/lpipe.dasare byte-identical to master, andast_verifyonly runs under--ast-verify, which this repro does not pass.How it was hit
Writing an emitter change in
modules/dasLLVM/daslib/llvm_jit.das, by mis-spelling the two-blockbuild_select(...) { ... } lpipe() { ... }idiom asreturn build_select(...) { ... }followed bylpipe() { ... }. A crash rather than an error makes that typo needlessly expensive to find —daslang utils/lint/main.das -- <file>also dies, so the usual check gives no clue either.Environment
Linux, clang 20.1.2, Release build.