http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47148
H.J. Lu <hjl.tools at gmail dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |hjl.tools at gmail dot com --- Comment #4 from H.J. Lu <hjl.tools at gmail dot com> 2011-01-01 21:03:08 UTC --- (In reply to comment #3) > the caller indeed does the needed promotions, as CALL_EXPR's argument has int > type rather than unsigned char. But when calling the artificial foo.part.0, > the > argument passed to it is unsigned char 255 rather than int 255 and it sets a > QImode %rdi register to -1 (i.e. 255) instead of setting SImode %rdi register > to 255, which means it is incorrectly sign extended instead of zero extended. I proposed to update x86-64 psABI to --- When a value of type _Bool is returned in a register, bit 0 contains the truth value and bits 1 to 7 shall be zero. When an argument of type _Bool is passed in a register or on the stack, bit 0 contains the truth value and bits 1 to 31 shall be zero. When a value of type signed/unsigned char or short is returned in a register, bits 0 to 7 for char and bits 0 to 15 for short contain the value and other bits are left unspecified. When an argument of signed/unsigned type char or short is passed in a register or on the stack, it shall be sign/zero extended to signed/unsigned int. --- http://gcc.gnu.org/ml/gcc/2010-12/msg00525.html