Skip to content

Fix ICE when calling transmuted function pointers#873

Open
cijiugechu wants to merge 5 commits intorust-lang:masterfrom
cijiugechu:fix/transmuted-fn-ptr-call
Open

Fix ICE when calling transmuted function pointers#873
cijiugechu wants to merge 5 commits intorust-lang:masterfrom
cijiugechu:fix/transmuted-fn-ptr-call

Conversation

@cijiugechu
Copy link
Copy Markdown

@cijiugechu cijiugechu commented Apr 10, 2026

Indirect calls could keep the original libgccjit function-pointer type after a transmute instead of the ABI-lowered type expected at the call site, so ZST-elided arguments made libgccjit see the wrong arity and ICE. Cast the callee to the call-site function-pointer type before emitting the indirect call so argument checking and codegen use the normalized signature.

Closes: #836

Cast function pointers to the ABI expected at the call site before emitting indirect calls so transmuted ZST arguments don't trip libgccjit's arity checks. Add a compile-only regression test for the ignored-argument case.
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: gcc_jit_context_new_call_through_ptr: not enough arguments to fn_ptr

2 participants