Stream: beginners

Topic: What to do about SIGSEGV?


view this post on Zulip Asbjørn Olling (Dec 09 2023 at 13:59):

I'm working on advent of code 8-2, and I'm getting this error at runtime:

fish: Job 1, './main' terminated by signal SIGSEGV (Address boundary error)

It happens on both roc dev and on roc build && ./main

I understand that in principle roc programs shouldn't ever segfault, so it's probably a compiler (or platform?) bug.

My code is pretty slow, so although I'm fairly sure I haven't caused an infinite recursion, I don't want to rule it out completely.
But it's not swalloing a lot of ram, and my slow function is tail recursive, so I don't think it should be that bad memory-wise either.

What steps can I take to try and debug this?

view this post on Zulip Asbjørn Olling (Dec 09 2023 at 14:17):

okay yeah my function was bad. It worked exactly how I wanted it to, but I had made some incorrect assumptions about the input data :sweat_smile:

Anyway, should I expect roc functions to segfault if I do infinite recursion? Even if it's tail-recursive?
I recently learned from a friend that this is the only way for a (non-unsafe) rust program to segfault.
Maybe this is actually expected behavior from roc?

For context, it crashed after 78111 (tail-)recursions


Last updated: Jul 06 2025 at 12:14 UTC