This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug target/19566] x86_64 - inconsistent choice of parameter passing method for 16 byte struct



------- Comment #7 from hubicka at gcc dot gnu dot org  2008-09-26 22:56 -------
Hi,
so to be sure I didn't mess up anything.  The following is testcase I use:
typedef struct shared_ptr_struct
{
  unsigned long phase:48;
  unsigned int thread:16;
  void *addr;
} shared_ptr_t;


int y;
shared_ptr_t sp = { 1, 2, &y };

int
get_thread (shared_ptr_t p)
{
  return p.thread;
}

int
main ()
{
  int t = get_thread (sp);
  return t;
}

The following is assembly I get:
get_thread:
.LFB0:
        .cfi_startproc
        movq    %rdi, %rax
        shrq    $48, %rax
        ret
        .cfi_endproc
.LFE0:
        .size   get_thread, .-get_thread
        .p2align 4,,15
.globl main
        .type   main, @function
main:
.LFB1:
        .cfi_startproc
        movq    sp(%rip), %rdi
        movq    sp+8(%rip), %rsi
        jmp     get_thread
        .cfi_endproc
.LFE1:

i.e. everything is passed in registers.  I get same code from GCC-4.1
get_thread:
.LFB2:
        movq    %rdi, -16(%rsp)
        movzwl  -10(%rsp), %eax
        ret
.LFE2:
        .size   get_thread, .-get_thread
        .p2align 4,,15
.globl main
        .type   main, @function
main:
.LFB3:
        movq    sp(%rip), %rdi
        movq    sp+8(%rip), %rsi
        jmp     get_thread
.LFE3:

THis is oldest GCC I have around.   I remember debugging this problem once
before, probably in different duplicate of this PR so I hope it is long fixed.


-- 

hubicka at gcc dot gnu dot org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|ASSIGNED                    |WAITING


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]