Commit "crash section line 240 - 244"
18b860962c077031007f96150f6367787bb194d0
in file https://github.com/salarii/peek/blob/main/regex.roc
this crash is very annoying because unlike in other cases I can't figure out ways around it : ( . I have to uncomment for now
I'll try to take a look today
this commit 37f0e9be0b014590b346cc75b6642938b352d78b also crash
It is vicious because it does not inform even that it is crashing, and it is unrelated to previous issue
I won't be able to look at this today or tomorrow, is someone else able to help out?
I wanted to look but didn't get to it and will be travelling. Not sure I'll get a chance.
I haven't found the issue causing this segfault yet.
But I do have some tips which I find help me with these kind of issues.
expect
roc check
and working through to resolve all the warnings oftens helps lead me to a place where I see an issue.The current implementation of dbg
has been a common cause of bugs. It will soon be replaced with the Inspect
ability which will significantly improve dbg
stability I think.
In the below snippet you are using the Character
tag in two different ways, one without a payload and one with.
getRegexTokens = \result ->
when result.tag is
Character ->
when List.first result.parsedResult.matched is
Ok matched ->
Ok [createToken (Character matched) Once Bool.false]
Err _ -> Err "character tag problem"
_ ->
Err "wrong tag"
I'm finding it difficult to follow the types through this. I've spent some time adding annotations and looking at this, but it is a pretty big and complex.
I would love to find the segfault, but I probably should move on to other things.
If you have the time and are able add more type annotations, I think you could narrow this issue down, and it would be really helpful to make an issue with a minimal reproduction of the segfault. Just keep removing code until you have a minimal example.
sorry I knew where bug was I spotted it myself but I was complaining that that application does not report crash or anything was it ok ?
clearly I made mistake but that wasn't the point , I did not expect compiler to show just nothing as it is and I was reporting that
regarding type annotation good and bad point at the same time, usually I don't know what I want, so I let compiler to decide, additionally I do not have skill to add proper types anyway. Still compiler should do it's work and provide some feedback about crash or some discrepancies.
beside that, some types, I am using are complex and to write them down it would be painful , and I am grateful I don't have to
You might find out helpful to use roc check
until there are 0 reported errors, and only then use roc run
. Roc will still try to run your code when there are issues, but if it runs into one of the invalid code paths it will crash. Right now that crash message is not helpful.
I was using run dev , I expect it to show something
because it usually does but not this time
sorry I messed up completely I was talking about second problem :joy:
Thx for tips for first problem :sweat_smile:
Sorry, I should have mentioned this additional context. I misunderstood your original question.
It looks like you have found a compiler bug. The issue you are seeing is that the executable that is generated is invalid, and when executed it segfaults on your machine.
You are not seeing a nice error message because it is not caused by a roc crash
or rust panic
.
This is certainly a bug in the compiler.
As Roc is still young and maturing, it is unfortunately still easy to run into these issues.
In future these will be really uncommon as the compiler is battle tested against lots of different kinds of programs. To help us get there, it is really helpful when you find an issue like this to report it. This way it can be fixed, and a test added to prevent future regressions.
to be clear first issue I haven't solved yet <--- your tips for that is to annotate more ??
second reported issue <--- this is easy , just reported that compiler is silent
type annotations may help me solve first one?
The problem is that when I narrowed down a bit problematic code it seemed to work only together it seems to fail.
btw. it is true. In this specific code I am using sometimes the same tag by name in different context without warning.
Last updated: Jul 06 2025 at 12:14 UTC