Stream: beginners

Topic: AoC-22-12 Segfault


view this post on Zulip Luke Boswell (Jun 12 2023 at 06:46):

Ok, so I've ran across an interesting issue I think. I have been experimenting with some AoC code and came across a Segmentation fault when using --optimize. I've pushed the code here for reference.

I've tried a few different combinations of things and the only thing that I have found that consitently causes it to occur is the --optimize flag.

However, if I comment out the "sampleInput" for part1, I find it does build and runs perfectly ok with --optimize. When I can do this with optimization on it runs reasonably quick (real 0m2.203s) versus without (real 0m32.181s). I'm not sure if optimised performance has any relevance to the segfault though.

$ roc build --optimize  aoc-2022/12/main.roc
0 errors and 0 warnings found in 2845 ms while successfully building:

    aoc-2022/12/aoc
$ ./aoc-2022/12/aoc
Segmentation fault: 11
$ roc build aoc-2022/12/main.roc
0 errors and 0 warnings found in 1648 ms while successfully building:

    aoc-2022/12/aoc
$ ./aoc-2022/12/aoc
Part 1 - Shortest steps is: 31
Part 1 - Shortest steps is: 391

view this post on Zulip Richard Feldman (Jun 12 2023 at 10:29):

what operating system is this on?

view this post on Zulip Luke Boswell (Jun 12 2023 at 19:53):

macOS

view this post on Zulip Richard Feldman (Jun 12 2023 at 23:19):

interesting...can you open an issue?

view this post on Zulip Luke Boswell (Jun 13 2023 at 07:10):

Posted an issue 5545, and also made a minimised version


Last updated: Jul 05 2025 at 12:14 UTC