[Bug target/15302] New: gcc not consistent for passing structures with complex in them

hjl at lucon dot org gcc-bugzilla@gcc.gnu.org
Wed May 5 19:43:00 GMT 2004


According to ABI structures are classified based on 8bytes recrsively to 
determine if they are passed in register or memory.  The 2 examples below pass 
similiar structures (according to ABI complex should be treated as struct with 
2 floats) but gcc uses memory in one case (call to bar1) and registers in the 
other case (call to foo1)
#include "complex.h"
struct st{
   int s1;
   float complex x;
   int s2;
} st1;
bar()
{
   bar1(st1);
}
/**********************
LCFI2:
        movq    st1(%rip), %rax
        movq    %rax, (%rsp)
        movq    st1+8(%rip), %rax
        movq    %rax, 8(%rsp)
        movl    $0, %eax
        call    bar1
**********************/
typedef struct { float r, i; } _complex;
struct stc{
   int s1;
   _complex x;
   int s2;
}st2;
foo()
{
   foo1(st2);
}

/**********************
.LCFI4:
        movq    st2(%rip), %rdi
        movq    st2+8(%rip), %rsi
        movl    $0, %eax
        call    foo1
**********************/

-- 
           Summary: gcc  not consistent for passing structures with complex
                    in them
           Product: gcc
           Version: 3.4.1
            Status: UNCONFIRMED
          Keywords: ABI
          Severity: critical
          Priority: P2
         Component: target
        AssignedTo: jh at suse dot cz
        ReportedBy: hjl at lucon dot org
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: x86_64-pc-linux-gnu
  GCC host triplet: x86_64-pc-linux-gnu
GCC target triplet: x86_64-pc-linux-gnu


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=15302



More information about the Gcc-bugs mailing list