Stream: beginners

Topic: modified CLI example crashing


view this post on Zulip Matthias Beyer (Oct 29 2021 at 06:55):

Hi.
I started playing with the platform bit and tried to copy the "cli" example to implement a new example where I pass arguments to the binary and they get reversed and printed. Here is my current codebase: https://github.com/matthiasbeyer/roc/tree/add-example-reverse/examples/reverse although it does not work yet and I don't see why. If HEAD is reverted, it works, but as soon as I introduce List.reverse to the roc code, it segfaults with free(): invalid pointer. How can I debug this or what am I doing wrong here?

Sorry for hijacking this thread... :sweat_smile:

view this post on Zulip Folkert de Vries (Oct 29 2021 at 08:27):

that link does not work for me

view this post on Zulip Folkert de Vries (Oct 29 2021 at 08:28):

but most likely, something is freed by both rust and roc

view this post on Zulip Joseph Anthony Zullo (Oct 29 2021 at 17:27):

The github repo you posted is invite only, and this is a bug since Roc shouldn't be able to segfault. I don't know how to debug it, things are still in pretty early stages here, my first non-trivial roc program also crashes the compiler.

view this post on Zulip Anton (Oct 29 2021 at 17:33):

Doing cargo run check <your_project/SomeFile.roc> first can sometimes reveal errors in your program that cause the compiler to crash when doing just cargo run <your_project/SomeFile.roc>.

view this post on Zulip Richard Feldman (Oct 29 2021 at 17:36):

this is a bug since Roc shouldn't be able to segfault

of note, Roc application code should never segfault, but under the hood platforms can use languages that can segfault - so if you make a change to a platform and the result is a segfault, that's not necessarily a bug in Roc!

view this post on Zulip Matthias Beyer (Oct 29 2021 at 17:48):

okay, I am wondering why the repo is invite-only if it is a clone of the original roc repo ... all members of the roc repo should have access by default, right? Strange.
The platform is written in Rust (as I copied the cli example). I will see how I can debug it! Thanks so far.
Btw check does return zero

view this post on Zulip Richard Feldman (Oct 29 2021 at 17:54):

@Matthias Beyer feel free to just use a branch directly in this repo!

view this post on Zulip Matthias Beyer (Oct 29 2021 at 18:15):

Yeah, I will try for myself for now, to learn to navigate the codebase and how things work internally. :laughing: but thanks!


Last updated: Jul 05 2025 at 12:14 UTC