Stream: bugs

Topic: Bug: Running num.Pow results in a crash


view this post on Zulip Agustin Romero (Dec 08 2024 at 22:06):

app [main!] {
    pf: platform "../basic-cli/platform/main.roc",
}
import pf.Stdout


main! = \{} ->
    _ = Num.pow 1 1
    Stdout.write! "hi"

Running num.Pow is giving a compiler error, is this a known issue? Current running on roc commit d782542 (PI)

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

There could be a few things going on here.

Does this happen for you in the REPL? if you use $ roc repl?

view this post on Zulip Luke Boswell (Dec 08 2024 at 22:09):

Can you share the error message too please?

view this post on Zulip Agustin Romero (Dec 08 2024 at 22:10):

repl works fine!

here is the error

An internal compiler expectation was broken.
This is definitely a compiler bug.
Please file an issue here: <https://github.com/roc-lang/roc/issues/new/choose>
Undefined Symbol in relocation, (+124a, Relocation { kind: PltRelative, encoding: Generic, size: +20, target: Symbol(SymbolIndex(+71)), addend: +fffffffffffffffc, implicit_addend: false }): Ok(Symbol { name: "log", address: +0, size: +0, kind: Unknown, section: Undefined, scope: Unknown, weak: false, flags: Elf { st_info: +10, st_other: +0 } })
Location: crates/linker/src/elf.rs:1452:25

view this post on Zulip Anthony Bullard (Dec 08 2024 at 22:10):

It only fails when you assign the value

view this post on Zulip Anthony Bullard (Dec 08 2024 at 22:10):

To a discard binding

view this post on Zulip Anthony Bullard (Dec 08 2024 at 22:11):

Does that track with what you see @Agustin Romero ?

view this post on Zulip Anthony Bullard (Dec 08 2024 at 22:12):

Num.pow 1 1

and

a = Num.pow 1 1

works in Repl

But

_ = Num.pow 1 1

crashes in Repl. But I think binding to a _ in the repl always crashes. Is that known?

view this post on Zulip Anthony Bullard (Dec 08 2024 at 22:12):

Oh yeah

view this post on Zulip Agustin Romero (Dec 08 2024 at 22:13):

not really.

this crashes

app [main!] {
    pf: platform "../basic-cli/platform/main.roc",
}
import pf.Stdout

main! = \{} -> Stdout.write! "$(Inspect.toStr (2^2))\n"

An internal compiler expectation was broken.
This is definitely a compiler bug.
Please file an issue here: <https://github.com/roc-lang/roc/issues/new/choose>
ambient functions don't unify
Location: crates/compiler/unify/src/unify.rs:202:18

view this post on Zulip Anthony Bullard (Dec 08 2024 at 22:13):

Only handles ident binding

view this post on Zulip Agustin Romero (Dec 08 2024 at 22:14):

and assigning to a variable crashes aswell

app [main!] {
    pf: platform "../basic-cli/platform/main.roc",
}
import pf.Stdout

main! = \{} ->
    a = 2 ^ 2
    Stdout.write! ""

An internal compiler expectation was broken.
This is definitely a compiler bug.
Please file an issue here: <https://github.com/roc-lang/roc/issues/new/choose>
Undefined Symbol in relocation, (+124a, Relocation { kind: PltRelative, encoding: Generic, size: +20, target: Symbol(SymbolIndex(+71)), addend: +fffffffffffffffc, implicit_addend: false }): Ok(Symbol { name: "log", address: +0, size: +0, kind: Unknown, section: Undefined, scope: Unknown, weak: false, flags: Elf { st_info: +10, st_other: +0 } })
Location: crates/linker/src/elf.rs:1452:25

view this post on Zulip Luke Boswell (Dec 08 2024 at 22:15):

Are you using the legacy linker?

view this post on Zulip Luke Boswell (Dec 08 2024 at 22:16):

Undefined Symbol in relocation

this makes me think it may be linker related

view this post on Zulip Agustin Romero (Dec 08 2024 at 22:16):

no i wasn't let me give that a try

view this post on Zulip Luke Boswell (Dec 08 2024 at 22:16):

Oh... the log has me thinking maybe the way I'm handling the Err from main is the issue.

Can you add a type annotation to main! and try again?

view this post on Zulip Agustin Romero (Dec 08 2024 at 22:17):

legacy linker makes it run

view this post on Zulip Luke Boswell (Dec 08 2024 at 22:18):

I'm confused where this log symbol is coming from

view this post on Zulip Agustin Romero (Dec 08 2024 at 22:20):

adding the type annotation didn't help

view this post on Zulip Agustin Romero (Dec 08 2024 at 22:20):

app [main!] {
    pf: platform "../basic-cli/platform/main.roc",
}
import pf.Stdout

main! : {} => Result {} [StdoutErr [
        AlreadyExists,
        BrokenPipe,
        Interrupted,
        NotFound,
        Other Str,
        OutOfMemory,
        PermissionDenied,
        Unsupported,
    ]]
main! = \{} ->
    a = 2 ^ 2
    Stdout.write! ""

An internal compiler expectation was broken.
This is definitely a compiler bug.
Please file an issue here: <https://github.com/roc-lang/roc/issues/new/choose>
Undefined Symbol in relocation, (+124a, Relocation { kind: PltRelative, encoding: Generic, size: +20, target: Symbol(SymbolIndex(+71)), addend: +fffffffffffffffc, implicit_addend: false }): Ok(Symbol { name: "log", address: +0, size: +0, kind: Unknown, section: Undefined, scope: Unknown, weak: false, flags: Elf { st_info: +10, st_other: +0 } })
Location: crates/linker/src/elf.rs:1452:25

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

And you're running x64 linux right?

view this post on Zulip Luke Boswell (Dec 08 2024 at 22:23):

It's working ok for me on my arm64 mac

view this post on Zulip Agustin Romero (Dec 08 2024 at 22:23):

x64 linux, correct

view this post on Zulip Luke Boswell (Dec 08 2024 at 22:23):

We have a related issue https://github.com/roc-lang/roc/issues/7068

view this post on Zulip Agustin Romero (Dec 08 2024 at 22:25):

Totally missed it. Would that be a good first issue for me to solve?

view this post on Zulip Luke Boswell (Dec 08 2024 at 22:26):

I suspect this is a known issue, I'm having trouble tracking down the related Issue.

@Brendan Hansknecht would probably know from looking at this error message if we are already tracking.

view this post on Zulip Agustin Romero (Dec 08 2024 at 22:29):

I'm asking if adding the recommendation could be a good first issue, not expecting to fix the actual issue myself :laughing:

view this post on Zulip Luke Boswell (Dec 08 2024 at 22:29):

Agustin Romero said:

Totally missed it. Would that be a good first issue for me to solve?

Anton has labelled it as an intermediate issue.

Maybe for providing more information as recommended in this issue it's as simple as including a note in internal_error macro message. That would be easy to do.

view this post on Zulip Agustin Romero (Dec 08 2024 at 22:33):

if you think it's possible i'll take a look, have some spare time right now

view this post on Zulip Brendan Hansknecht (Dec 08 2024 at 23:47):

why does pow need log....strange

view this post on Zulip Agustin Romero (Dec 09 2024 at 00:06):

Should i create a fork to create a PR, i'd be changing a single line

view this post on Zulip Luke Boswell (Dec 09 2024 at 00:23):

If you don't have contributor / write access to the repo you will need a fork.

view this post on Zulip Agustin Romero (Dec 09 2024 at 00:28):

got it.
https://github.com/roc-lang/roc/pull/7323


Last updated: Jul 06 2025 at 12:14 UTC