Skip to content

Fix ICE on libcall signature mismatch - #1688

Merged
bjorn3 merged 7 commits into
rust-lang:mainfrom
0xmuon:fix8
Aug 12, 2026
Merged

Fix ICE on libcall signature mismatch#1688
bjorn3 merged 7 commits into
rust-lang:mainfrom
0xmuon:fix8

Conversation

@0xmuon

@0xmuon 0xmuon commented Aug 9, 2026

Copy link
Copy Markdown
Contributor

Description

When code calls f32.powi(),Cranelift lowers it to a libcall named __powisf2.If you also define your own #[no_mangle] fn __powisf2() with the wrong signature, backend tried to declare the symbol twice with different types and hit an unwrap(), which caused an internal compiler error instead of a normal error message.
I fixed it by pulling the import declaration logic into a shared helper and using that for libcalls too,so signature conflicts now fail with a clear “attempt to declare __powisf2…” message like other function imports already do.

I also added a small repro in example/powi-libcall-signature.rs and a test to make sure this case errors cleanly and never ICEs again.

fixes: #1682

Comment thread example/powi-libcall-signature.rs
Comment thread build_system/tests.rs Outdated
@bjorn3
bjorn3 merged commit 74efd87 into rust-lang:main Aug 12, 2026
24 of 25 checks passed
@bjorn3

bjorn3 commented Aug 12, 2026

Copy link
Copy Markdown
Member

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

ICE IncompatibleSignature

3 participants