Bug#85535: acknowledged by developer (Bug#85535: fixed in gcc-3.3 1:3.3ds9-1)
reopen 85535
quit
On Sat, May 17, 2003 at 04:51:38PM -0500, Debian Bug Tracking System wrote:
> This is an automatic notification regarding your Bug report
> #85535: [fixed in gcc-3.1, PR optimization/3508]: builtin memcmp() could be optimised,
> which was filed against the gcc package.
>
> It has been closed by one of the developers, namely
> Matthias Klose <doko@debian.org>.
Unfortunately this bug has only been special cased rather than fixed
in its full generality. If we change one of the arguments to a
variable, the compiler still fails to produce the dword comparison
that I would expect:
-- a.c --
int foo(const char *s) {
return !memcmp("abcd", s, 4);
}
-- gcc -S -O2 a.c --
.LC0:
.string "abcd"
.text
.p2align 2,,3
.globl foo
.type foo, @function
foo:
pushl %ebp
movl %esp, %ebp
pushl %edi
pushl %esi
movl 8(%ebp), %edi
movl $.LC0, %esi
movl $4, %ecx
cld
repz
cmpsb
sete %al
popl %esi
movzbl %al, %eax
popl %edi
leave
ret
.size foo, .-foo
.ident "GCC: (GNU) 3.3 20030509 (Debian prerelease)"
--
Debian GNU/Linux 3.0 is out! ( http://www.debian.org/ )
Email: Herbert Xu ~{PmV>HI~} <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt
Reply to: