This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Suboptimal code generated for _Bool
- From: Marcin 'Qrczak' Kowalczyk <qrczak at knm dot org dot pl>
- To: gcc at gcc dot gnu dot org
- Date: Sun, 20 Jun 2004 12:14:07 +0200
- Subject: Suboptimal code generated for _Bool
This module:
#include <stdbool.h>
bool test1(int x) {return x == 5;}
bool test2(int x) {return test1(x);}
is compiled by gcc-3.4.0 on x86, invoked by
'gcc -S -O2 -fomit-frame-pointer bool.c',
to the following code:
[...]
test2:
subl $4, %esp
movl 8(%esp), %eax
movl %eax, (%esp)
call test1
addl $4, %esp
movzbl %al, %eax
ret
The movzbl is completely unnecessary. It's inserted even if the called
function is inline.
--
__("< Marcin Kowalczyk
\__/ qrczak@knm.org.pl
^^ http://qrnik.knm.org.pl/~qrczak/