Skip to content

win-x64: indirect call with mixed int/fp scalar args passes arguments in the wrong registers (positional Win64 slots) #375

Description

@kromych

On Windows x64 (host-native, kromyrzen), an indirect call through a function-pointer variable with mixed int and fp scalar arguments produces a wrong value: the fixture indirect_call_mixed_fp_int_args.c (interleaved int/double parameters called via T (*volatile fp)(...)) exits 1 (first check fails) where it exits 0 on macOS arm64, Linux x64/arm64, and under --interp.

Pre-existing, not introduced by the aarch64 indirect-call marshal change: that change left every x64 snapshot byte-identical (verified during its review), so the x64 lowering is untouched — the fixture is simply the first coverage of the mixed-scalar indirect shape on Win64. Suspect area: Win64 assigns argument slots positionally (integer and vector registers alias per position: rcx/xmm0, rdx/xmm1, r8/xmm2, r9/xmm3), unlike SysV's independent int/fp banks; the x86_64 indirect-call marshal presumably classifies with SysV-style separate counters when the target is a pointer (fp_arg_mask consumers) — contrast x86_64/emit.rs emit_call_indirect's Win64 path against the direct-call path.

The fixture stays wired everywhere except the Windows x64 host lane (TODO in programs.rs); re-enable when fixed.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingmiscompileEmits wrong machine codeseverity:highWrong codegen/diagnostics or crash on valid input

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions