[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

gcc-3.3 mis-compiles apache



Hi,

I upgraded to unstable's Apache 1.3.27.0-2 package, and it appears
broken due to a gcc 3.3 bug.  I can recreate this building locally
using gcc version 3.3.1 20030626, with either -O0 or -O1.  I have got
Apache working again by building with the gcc-snapshot (gcc 3.4)
package which produces correct code.

The problem point is server_type() in src/main/http_core.c

static const char *server_type(cmd_parms *cmd, void *dummy, char *arg)
{
    const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
    if (err != NULL) {
        return err;
    }
 
    if (!strcasecmp(arg, "inetd")) {
        ap_standalone = 0;
    }
    else if (!strcasecmp(arg, "standalone")) {
        ap_standalone = 1;
    }
    else {
        return "ServerType must be either 'inetd' or 'standalone'";
    }
 
    return NULL;
}

It will crash if the ServerType directive (i.e. passed in via char
*arg) is "standalone".  Any other value (i.e. inetd or an incorrect
value) works OK.  Output from objdump -S for the function is attached.
The problem point (I think) is at 20fb0 ; r14 is set to 1 at 20f9c
then a load is attempted from it.

Can anyone see a simple test case?  All my attempts so far have
created correct code.

Should this be filed as a bug?  Would it be an apache bug or a gcc
bug?

-i
ianw@gelato.unsw.edu.au
http://www.gelato.unsw.edu.au
4000000000020ea0 <server_type>:

static const char *server_type(cmd_parms *cmd, void *dummy, char *arg)
{
4000000000020ea0:	10 20 21 0c 80 05 	[MIB]       alloc r36=ar.pfs,8,6,0
    const char *err = ap_check_cmd_context(cmd, GLOBAL_ONLY);
4000000000020ea6:	70 fa 00 00 48 00 	            mov r39=31
4000000000020eac:	00 00 00 20       	            nop.b 0x0
4000000000020eb0:	01 28 01 02 00 21 	[MII]       mov r37=r1
4000000000020eb6:	30 02 00 62 00 c0 	            mov r35=b0
4000000000020ebc:	04 00 01 84       	            mov r38=r32;;
4000000000020ec0:	11 00 00 00 01 00 	[MIB]       nop.m 0x0
4000000000020ec6:	00 00 00 02 00 00 	            nop.i 0x0
4000000000020ecc:	78 cb ff 58       	            br.call.sptk.many b0=400000000001da30 <ap_check_cmd_context>;;
4000000000020ed0:	00 08 00 4a 00 21 	[MII]       mov r1=r37
    if (err != NULL) {
4000000000020ed6:	60 02 88 00 42 c0 	            mov r38=r34
4000000000020edc:	00 40 1c e4       	            cmp.eq p6,p7=0,r8
4000000000020ee0:	1d 70 00 10 00 21 	[MFB]       mov r14=r8
4000000000020ee6:	00 00 00 02 00 00 	            nop.f 0x0
4000000000020eec:	00 00 00 20       	            nop.b 0x0;;
4000000000020ef0:	10 38 e1 02 1f 24 	[MIB]       addl r39=4024,r1
4000000000020ef6:	00 00 00 02 00 03 	            nop.i 0x0
4000000000020efc:	30 00 00 43       	      (p06) br.cond.dpnt.few 4000000000020f20 <server_type+0x80>
4000000000020f00:	00 40 00 1c 00 21 	[MII]       mov r8=r14
4000000000020f06:	00 20 01 55 00 00 	            mov.i ar.pfs=r36
4000000000020f0c:	30 0a 00 07       	            mov b0=r35
4000000000020f10:	11 00 00 00 01 00 	[MIB]       nop.m 0x0
4000000000020f16:	00 00 00 02 00 80 	            nop.i 0x0
4000000000020f1c:	08 00 84 00       	            br.ret.sptk.many b0;;
4000000000020f20:	11 38 01 4e 18 10 	[MIB]       ld8 r39=[r39]
4000000000020f26:	00 00 00 02 00 00 	            nop.i 0x0
4000000000020f2c:	c8 8c fe 58       	            br.call.sptk.many b0=4000000000009be0 <_init+0x1180>;;
4000000000020f30:	01 08 00 4a 00 21 	[MII]       mov r1=r37
4000000000020f36:	70 00 20 0c 73 c0 	            cmp4.eq p7,p6=0,r8
4000000000020f3c:	04 10 01 84       	            mov r38=r34;;
4000000000020f40:	02 78 90 03 4f 24 	[MII]       addl r15=10212,r1
4000000000020f46:	70 02 06 3e 48 00 	            addl r39=4032,r1;;
4000000000020f4c:	00 00 04 00       	            nop.i 0x0
4000000000020f50:	09 70 00 1e 00 21 	[MMI]       mov r14=r15
        return err;
    }

    if (!strcasecmp(arg, "inetd")) {
        ap_standalone = 0;
    }
    else if (!strcasecmp(arg, "standalone")) {
4000000000020f56:	70 02 9c 30 20 00 	            ld8 r39=[r39]
4000000000020f5c:	00 00 04 00       	            nop.i 0x0;;
4000000000020f60:	f0 00 00 1c 90 11 	[MIB] (p07) st4 [r14]=r0
4000000000020f66:	00 00 00 02 80 03 	            nop.i 0x0
4000000000020f6c:	60 00 00 43       	      (p07) br.cond.dpnt.few 4000000000020fc0 <server_type+0x120>
4000000000020f70:	11 00 00 00 01 00 	[MIB]       nop.m 0x0
4000000000020f76:	00 00 00 02 00 00 	            nop.i 0x0
4000000000020f7c:	78 8c fe 58       	            br.call.sptk.many b0=4000000000009be0 <_init+0x1180>;;
4000000000020f80:	03 08 00 4a 00 21 	[MII]       mov r1=r37
4000000000020f86:	70 00 20 0c 73 c0 	            cmp4.eq p7,p6=0,r8;;
4000000000020f8c:	41 0e 3c 91       	            addl r14=10212,r1;;
4000000000020f90:	03 78 00 1c 00 21 	[MII]       mov r15=r14
4000000000020f96:	e0 40 06 3e c8 c3 	            addl r14=4040,r1;;
4000000000020f9c:	11 00 00 90       	      (p07) mov r14=1;;
4000000000020fa0:	e0 00 38 1e 90 11 	[MII] (p07) st4 [r15]=r14
4000000000020fa6:	00 00 00 02 00 00 	            nop.i 0x0
4000000000020fac:	00 00 04 00       	            nop.i 0x0
        ap_standalone = 1;
    }
    else {
        return "ServerType must be either 'inetd' or 'standalone'";
4000000000020fb0:	13 70 00 1c 18 d0 	[MBB]       ld8 r14=[r14]
4000000000020fb6:	01 08 00 00 21 00 	      (p07) br.cond.dptk.few 4000000000020fc0 <server_type+0x120>
4000000000020fbc:	50 ff ff 48       	            br.few 4000000000020f00 <server_type+0x60>;;
4000000000020fc0:	11 70 00 00 00 21 	[MIB]       mov r14=r0
4000000000020fc6:	00 00 00 02 00 00 	            nop.i 0x0
4000000000020fcc:	40 ff ff 48       	            br.few 4000000000020f00 <server_type+0x60>;;

4000000000020fd0 <server_port>:
    }

    return NULL;
}

Reply to: