http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54130
--- Comment #11 from Richard Guenther <rguenth at gcc dot gnu.org> 2012-08-01 09:28:43 UTC --- (In reply to comment #10) > (In reply to comment #9) > > I realize that several (not all) of the things discussed here assume that > > functions returning bool and int are binary compatible, which is likely > > true on > > most platforms but there might be exceptions. > > It's not true on x86_64 - return values are not extended to word_mode thus > you may have garbage in the upper parts of %eax for bool. Testcase: _Bool foo (_Bool *p) { return *p; } compile at -Os and get foo: .LFB0: .cfi_startproc movb (%rdi), %al ret which I believe at least preserves %ah (not sure about bits 16 .. 32).