It seems like my AoC solution for day 1 is now segfaulting after the ranges PR. Should I look into it or is it something you are aware of already?
So the regression is related to the one-liner for my print! function.
print! = |msg| msg.split_on("\n").for_each!(Stdout.line!)
Before the latest PR, this works. But after the ranges PR, I now have to write it again with a for loop to not trigger a segfault. @Richard Feldman I believe you had fixed that issue in another PR a few days back. Some of your changes in the range PR might have re-introduced some negative effect on this line.
Hum actually it’s not just that. Context matters. I’m looking into it more and trying to make another minimal reproducible example.
Ok, this is the weirdest bug I’ve ever seen. Here is my minimal example with a segfault on main (4766997).
app [main!] { pf: platform "./platform/main.roc" }
import pf.Stdout
print! : Str => {}
print! = |msg| msg.split_on("\n").for_each!(Stdout.line!)
fnA : Str -> Try(I64, _)
fnA = |_input| {
var $x = 1
Ok($x)
}
fnB : Str -> Try(I64, _)
fnB = |_input| {
var $y = 2
Ok($y)
}
run! = || {
print!("A1: ${fnA("test")?.to_str()}")
print!("A2: ${fnA("test")?.to_str()}")
print!("A3: ${fnA("test")?.to_str()}")
Ok({})
}
main! = || {
_ignore = run!()
}
If I do any of the following things, there is NO segfault anymore.
This is truly a mystery to me how to minimize this segfault further.
❯ roc test/fx/segfault.roc
A1: 1
A2: 1
error: Child process /var/folders/q3/lls0f9bd6x112cdkq8bgjldr0000gn/T/roc-65931/segfault.roc killed by signal: 11
error: Child process crashed with segmentation fault (SIGSEGV)
This is truly a mystery to me how to minimize this segfault further.
Try getting a stacktrace with gdb: gdb --ex run --ex bt --args roc test/fx/segfault.roc that may get you some extra useful info.
I have my OS pretty locked down so that I can safely run codex --yolo or claude --dangerously-skip-permissions. They should be able to find the cause of the segfault in that mode but they don't always find the best fix.
I'll take a look!
https://github.com/roc-lang/roc/pull/8576 should fix this, although I'm not quite ready to land the PR yet - needs some changes, but if you try that branch it should unblock!
Indeed, it fixes the segfault for day 1 :)
Last updated: Dec 21 2025 at 12:15 UTC