Re: bug in 2.3-stable2 on freebsd 4.0, gcc 2.95.2

From: Adrian Chadd <adrian@dont-contact.us>
Date: Tue, 11 Apr 2000 19:57:52 +0800

On Tue, Apr 11, 2000, Adam wrote:
> With 'log_fqdn on' squid calls at some time rfc1035QuestionPack() which
> looks:
>
> static off_t
> rfc1035QuestionPack(char *buf,
> size_t sz,
> const char *name,
> unsigned short type,
> unsigned short class)
> {
> off_t off = 0;
> unsigned short s;
> off += rfc1035NamePack(buf + off, sz - off, name);
> (...)
>
> gcc 2.95.2 (default on 4.0-R) with -O2 compiles it into:
> rfc1035QuestionPack:
> pushl %ebp
> movl %esp,%ebp
> subl $28,%esp
> pushl %edi
> pushl %esi
> pushl %ebx
> movl 8(%ebp),%edi
> movl 12(%ebp),%eax
> XXX xorl %edx,%edx
> movl %eax,12(%ebp)
> XXX movl %edx,16(%ebp)
> movl 20(%ebp),%ebx
> movl 24(%ebp),%esi
> addl $-4,%esp
> pushl 16(%ebp)
> pushl %eax
> pushl %edi
> call rfc1035NamePack
> (...)
>
> Lines marked with 'XXX' clear parameter 'name'. Why? No idea, it's just
> a gcc bug.
> With name set to NULL squid gets SIGV when in rfc1035NamePack and dies.
> With -O or without optimalization it compiles and works fine.
> Maybe it's worth to put it into FAQ/INSTALL or whatever.
>
> Adam Kubicki
> vt@ikp.pl
>
> Here is my configuration:
>
> squid-2.3 stable2
>
> # uname -a
> FreeBSD cache.xxx.xxx 4.0-RELEASE FreeBSD 4.0-RELEASE #2: Mon Apr 10
> 20:16:33 CEST 2000 apk@cache.xxx.xxx:/usr/src/sys/compile/CACHE
> i386
> # gcc -v
> Using builtin specs.
> gcc version 2.95.2 19991024 (release)

YAY! This bug bit me again today. I just take out -O2 and it works, which
is ok for my development. What a coincidence that someone gives a more indepth
analysis :P

Want to forward this to the gcc guys ?

Adrian
Received on Tue Apr 11 2000 - 05:57:58 MDT

This archive was generated by hypermail pre-2.1.9 : Tue Dec 09 2003 - 16:12:23 MST