This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/54130] Recognize builtins with bool return type
- From: "rguenth at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 01 Aug 2012 09:28:43 +0000
- Subject: [Bug c++/54130] Recognize builtins with bool return type
- Auto-submitted: auto-generated
- References: <bug-54130-4@http.gcc.gnu.org/bugzilla/>
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).