bug in 2.3-stable2 on freebsd 4.0, gcc 2.95.2

From: Adam <vt@dont-contact.us>
Date: Tue, 11 Apr 2000 13:53:14 +0200

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)
Received on Tue Apr 11 2000 - 05:55:39 MDT

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