extern int foo (float _Complex); int main () { float _Complex z; __real__ z = 0.0; __imag__ z = -1.0; return foo (z); }
gcc -S -O2 complex.c .LEVEL 1.1 .section .rodata.cst4,"aM",@progbits,4 .align 4 .LC0: .word -1082130432 .text .align 4 .globl main .type main, @function main: .PROC .CALLINFO FRAME=64,CALLS,SAVE_RP .ENTRY stw %r2,-20(%r30) ldo 64(%r30),%r30 ldw -84(%r30),%r2 fcpy,sgl %fr0,%fr5L ldil LR'.LC0,%r19 ldo RR'.LC0(%r19),%r19 fldws 0(%r19),%fr5R bl foo,%r0 ldo -64(%r30),%r30 nop .PROCEND .size main, .-main .ident "GCC: (GNU) 3.3.4" The complex value is being passed in fr5L and fr5R. Although there is no definitive guidelines in the HP runtime documentation regarding how complex values should be passed on the PA-RISC architecture, my contacts at HP indicate complex values should be treated as aggregates and therefore should be passed in the general registers for float _Complex in the 32-bit runtime. double and long double _Complex should be passed by reference since aggregates larger than 64-bits are passed by reference. In the 64-bit runtime, they should be passed in the same manner as aggregates (i.e., in the general registers). There is a mention of homogenous floating point aggregates in the 64-bit runtime documentation but, unlike ia64, this was not implemented in HP PA64 compilers. -- Summary: Complex values passed in wrong registers Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: c AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: danglin at gcc dot gnu dot org GCC build triplet: hppa*-*-* GCC host triplet: hppa*-*-* GCC target triplet: hppa*-*-* http://gcc.gnu.org/bugzilla/show_bug.cgi?id=25731