[LLVMbugs] [Bug 5168] New: clang x86-64 abi does not set %rax when returning struct

bugzilla-daemon at cs.uiuc.edu bugzilla-daemon at cs.uiuc.edu
Mon Oct 12 00:33:17 PDT 2009


http://llvm.org/bugs/show_bug.cgi?id=5168

           Summary: clang x86-64 abi does not set %rax when returning struct
           Product: new-bugs
           Version: unspecified
          Platform: PC
        OS/Version: Linux
            Status: NEW
          Severity: normal
          Priority: P2
         Component: new bugs
        AssignedTo: unassignedbugs at nondot.org
        ReportedBy: xuzhongxing at gmail.com
                CC: llvmbugs at cs.uiuc.edu


x86-64 abi page 22 says "On return %rax will contain the address that has been
passed in by the caller in %rdi". But clang -O2 mode does not set %rax.

$ cat returnbig.c
struct s {
  int a[10];
};

struct s f(void) {
  struct s x;
  return x;
}

$ clang-cc -S -O2 returnbig.c

$ cat returnbig.s
        .file   "returnbig.c"


        .text
        .align  16
        .globl  f
        .type   f, at function
f:
        movq    $0, 24(%rdi)
        movq    $0, 16(%rdi)
        movq    $0, 8(%rdi)
        movq    $0, (%rdi)
        movq    $0, 32(%rdi)
        ret
        .size   f, .-f

        .section        .note.GNU-stack,"", at progbits


-- 
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the llvm-bugs mailing list