Stream: beginners

Topic: decimal crash during compile


view this post on Zulip Steven Chen (Jan 31 2024 at 00:47):

I wrote this and the compiler (latest nightly) simply crashes

main =
    a = 1.5dec
    Num.toStr a |> Stdout.line

But a=1.5dec works fine in repl mode. Is this a known bug?

view this post on Zulip Brendan Hansknecht (Jan 31 2024 at 00:54):

Interesting. I guess we have a bug in Dec toStr

view this post on Zulip Brendan Hansknecht (Jan 31 2024 at 00:55):

That is at least what I suspect the most.

view this post on Zulip Brendan Hansknecht (Jan 31 2024 at 00:58):

Work on m1 processor on main for me. Are you on an x86 machine?

view this post on Zulip Steven Chen (Jan 31 2024 at 01:01):

yeah. x86 linux

view this post on Zulip Steven Chen (Jan 31 2024 at 01:02):

dbg a also crashes

view this post on Zulip Brendan Hansknecht (Jan 31 2024 at 01:38):

So this may be the Dec alignment issue that we're just being discussed in compiler development. So it may be the case that we don't have a fix until the next llvm update. Cause the root cause is an llvm bug and it would be a significant hassle to work around it.

view this post on Zulip Steven Chen (Jan 31 2024 at 01:44):

Why repl works?

view this post on Zulip Brendan Hansknecht (Jan 31 2024 at 04:09):

Repl is the dev backend instead of llvm. That said, my guess here may be wrong. Could you file an issue on the repo?


Last updated: Jul 06 2025 at 12:14 UTC