[Bug target/42324] New: Gcc doesn't follow x86-64 psABI on _Bool

hjl dot tools at gmail dot com gcc-bugzilla@gcc.gnu.org
Mon Dec 7 18:19:00 GMT 2009


x86-64 psABI says:

---
When a value of type _Bool is passed in a register or on the stack,
the upper 63 bits of the eightbyte shall be zero.
---

However, gcc generates:

[hjl@gnu-6 tmp]$ cat b.c
_Bool myfunction(char val)
{
  return val;
}
[hjl@gnu-6 tmp]$ gcc -O2 -S b.c
[hjl@gnu-6 tmp]$ cat b.s
        .file   "b.c"
        .text
        .p2align 4,,15
.globl myfunction
        .type   myfunction, @function
myfunction:
.LFB0:
        .cfi_startproc
        testb   %dil, %dil
        setne   %al
        ret
        .cfi_endproc
.LFE0:
        .size   myfunction, .-myfunction

Icc generates:
        movsbq    %dil, %rax                                    #3.10
        movl      $1, %edx                                      #3.10
        testl     %eax, %eax                                    #3.10
        cmovne    %edx, %eax                                    #3.10
        ret                                                     #3.10


-- 
           Summary: Gcc doesn't follow x86-64 psABI on _Bool
           Product: gcc
           Version: 4.5.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: hjl dot tools at gmail dot com
GCC target triplet: x86_64-*-linux-gnu


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



More information about the Gcc-bugs mailing list