Stream: bugs

Topic: Compiler Crash in large-ish when expr with multiple guards


view this post on Zulip Anthony Bullard (Dec 03 2024 at 22:19):

Bringing light to this here for more visibility: 7302

Also discussed here on Zulip.

view this post on Zulip Anthony Bullard (Dec 03 2024 at 22:20):

TL;DR: I have a when expression with about 20 clauses, 7 of which have guards. I get an unwork-aroundable compiler crash during mono IR unless I remove one of two guards (The same set of guards are used in the same order, but don't cause an issue).

view this post on Zulip Anthony Bullard (Dec 03 2024 at 22:21):

All this because I wanted to see if avoiding Strings would make my AOC solution faster!

view this post on Zulip Luke Boswell (Dec 03 2024 at 22:30):

Thank you for digging into and reporting this.

view this post on Zulip Anthony Bullard (Dec 04 2024 at 03:20):

No worries, I found a fix, and it's not pleasant and I think harmed the perf of the solution. But I updated the issue with good information on what allowed me to work around it

view this post on Zulip Anthony Bullard (Dec 04 2024 at 03:23):

I'd love to know if any function inlining happens in guards, because if not I'd try moving the guard logic back out of functions

view this post on Zulip Anthony Bullard (Dec 04 2024 at 03:25):

My last hope without getting _clever_ would be to try recursively inspecting a List U8 and building up the list of ops that way, and hope the compiler will emit a loop instead


Last updated: Jul 06 2025 at 12:14 UTC