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: [...@gnu-6 tmp]$ cat b.c _Bool myfunction(char val) { return val; } [...@gnu-6 tmp]$ gcc -O2 -S b.c [...@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