Stream: beginners

Topic: Unsure about how to report a bug


view this post on Zulip Asier Elorz (he/him) (Dec 06 2022 at 13:14):

I believe I have found a bug in List.concat (or adjacent code).
While programming the 5th day of advent of code I ended up in a situation where
List.concat a b
and
List.walk b a List.append
were giving me different result, which is nonsense since it is pretty trivial to observe that they are the same.

However, my reproduction is complex, it's 135 lines of code, and I don't really know how to simplify it without the bug disappearing. This also makes me think that maybe the bug is not the actual implementation of concat, but maybe Roc assuming that some shared object is actually unique and can be mutated, or some other optimization. I am not sure of what the best way of reporting this bug would be.

view this post on Zulip Folkert de Vries (Dec 06 2022 at 13:16):

can you put it in a gist? I think it depends a bit on what the code looks like and if the problem is obvious (with e.g. valgrind)

view this post on Zulip Asier Elorz (he/him) (Dec 06 2022 at 13:37):

https://gist.github.com/asielorz/a5128af84d254cce9c999c66257f37b7

I hope it helps

view this post on Zulip Folkert de Vries (Dec 06 2022 at 13:51):

hmm, the program fails on the input file for me

view this post on Zulip Folkert de Vries (Dec 06 2022 at 13:51):

is that bit at the top supposed to be there?

view this post on Zulip Asier Elorz (he/him) (Dec 06 2022 at 14:27):

Well, yes. Sorry for the bad bug report :sweat_smile:

I have updated it to a new version that does not need an external input file and still has the bug. The code is much shorter and much less noisy, and all file IO has been removed. I hope it helps.

view this post on Zulip Tommy Graves (Dec 06 2022 at 14:52):

I think this is possibly a similar issue to https://github.com/roc-lang/roc/issues/4697 where I managed to get a somewhat small reproduction. Interesting how many people are running into this considering it's not exactly trivial to reproduce!

view this post on Zulip Folkert de Vries (Dec 06 2022 at 14:53):

allright, I'll have to look in more detail, it's not (clearly, anyway) a memory corruption bug

view this post on Zulip Folkert de Vries (Dec 06 2022 at 14:53):

so it could indeed be an incorrect in-place mutation

view this post on Zulip Folkert de Vries (Dec 06 2022 at 14:54):

thanks for reporting!

view this post on Zulip Tommy Graves (Dec 06 2022 at 14:54):

I talked to @Ayaz Hafiz about it this morning too though I'm not sure if he was looking into it yet. Thanks Folkert and @Asier Elorz (he/him) !

view this post on Zulip Ayaz Hafiz (Dec 06 2022 at 21:43):

This should be fixed in tomorrow's nightly release of roc!


Last updated: Jul 26 2025 at 12:14 UTC