Suboptimal code generated for _Bool
Marcin 'Qrczak' Kowalczyk
qrczak@knm.org.pl
Sun Jun 20 10:14:00 GMT 2004
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/
More information about the Gcc
mailing list