Anything obvious that I am doing wrong here: https://gist.github.com/bhansconnect/4927cd203a407b98ee369da47c4f7e58
thread 'main' panicked at 'Error in alias analysis: error in module ModName("UserApp"), function definition FuncName("\x02\x00\x00\x00\x13\x00\x00\x00\xa1\xfb\xe2\xb3\x18i\xd5#"), definition of value binding ValueId(3): could not find func in module ModName("UserApp") with name FuncName("\x04\x00\x00\x00\'\x00\x00\x00\xa1\xfb\xe2\xb3\x18i\xd5#")', crates/compiler/gen_llvm/src/llvm/build.rs:5123:19
I assume it is an issue with recursive functions that return task? I am just not sure why. roc check
does pass.
Those are some funky FuncName
s!
They have a lot of non ASCII characters, even though the source code doesn't.
The message mentions alias analysis which is to do with reference counting and operates on the monomorphic IR. Probably worth dumping that to debug further.
This is a version that works: https://gist.github.com/bhansconnect/bbc096e1a19ad1056856bc0cb40a03c7
Still need to dig into exactly why the original version doesn't work. The core issue is recursively using tasks. Without Task.loop
the recursive tasks break and I get the alias error.
That link has the same hash as above and writeRow is a recursive task.
My bad. Updated.
We have several issues with that error.
I wonder if that means it is an unclear error with little valuable information or if it means that the error is caused by a consistent issue any many places. Maybe @Ayaz Hafiz has a guess?
If you hit a bug like that it's definitely a bug with the compiler middle/backend, not a user error
it usually means we have a miscompilation. almost certainly during the mono IR lowering
Since you can get a debug compiler, I would run ROC_CHECK_MONO_IR=1
when you build with the debug compiler - that's likely to print out where the problem in the miscompilation is
Interesting, an error recognizing two specializations are the same?
This is repeated for many different functions:
await : ({Str, {}}, {I64, I64, I64, I64}) ->
[<r>C {Str, {}} {I64, I64, I64, I64}, C Str {}, C [C I32, C {}]] ((niche {}))
was found
The following specializations of Task.await were built:await : ({Str, {}},
{I64, I64, I64, I64}) ->
[<r>C {Str, {}} {I64, I64, I64, I64}, C Str {}, C [C I32, C {}]] ((niche {}))
...
The built specialization matches the one that is claim to be missing here (minus some formatting to print).
maybe the lambda sets are off. the lambda names are missing in those types
Is this something you think it is worth me digging in and trying to debug or should I just collect this info and file a bug?
If you have the bandwidth and want to, yeah, absolutely go for it!
Any base tips for what to dive into? Haven't messed with specialization or lambda sets.
I would first look into what is actually the difference between the two specializations
for example here is where the procedure layout is being printed: https://github.com/roc-lang/roc/blob/ab2ec925a3038643d5da5c431d1773d34fc4100c/crates/compiler/mono/src/debug/report.rs#L537-L565
you might want to apply a diff like
diff --git a/crates/compiler/mono/src/debug/report.rs b/crates/compiler/mono/src/debug/report.rs
index bca214c26..7a7495c3e 100644
--- a/crates/compiler/mono/src/debug/report.rs
+++ b/crates/compiler/mono/src/debug/report.rs
@@ -550,16 +550,16 @@ where
let args = f.intersperse(
arguments
.iter()
- .map(|a| interner.to_doc(*a, f, &mut Default::default(), Parens::InFunction)),
+ .map(|a| format!("{:?}", interner.dbg_deep(*a))),
f.reflow(", "),
);
let fun = f.concat([
f.concat([f.reflow("("), args, f.reflow(")")]),
f.reflow(" -> "),
- interner.to_doc_top(result, f),
+ f.text(format!("{:?}", interner.dbg_deep(result))),
]);
let niche = (f.text("("))
- .append(captures_niche.to_doc(f, interner, &mut Default::default()))
+ .append(format!("{:?}", captures_niche.dbg_deep(interner)))
.append(f.text(")"));
f.concat([fun, f.space(), niche])
}
to print the whole represetntations
Wow is that a lot of output. Looks like built version truncates the tree with a recursive pointer, but the wanted version does not have that recursive pointer. Instead it nests much farther before hitting a recursive pointer. So they probably are equal, but something isn't being compressed into recursive pointers correctly.
I had completely minimized the basic-cli platform from when I hit this error, that may help reduce the output.
Last updated: Jul 05 2025 at 12:14 UTC