This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

RE: Cannot build egcs-1.1.1 on i386-sni-sysv4




> -----Original Message-----
> From: Jeffrey A Law [mailto:law@hurl.cygnus.com]
> The code in question did not change between egcs-1.1a and
> egcs-1.1.1.  So I
> have no idea how you got it to build the first time.
>
> The only thing I can think of is maybe the system compiler mis-compiled
> egcs.
>


Some more information.

1. The first attempt was to compile egcs-1.1.1 using egcs-1.1a. I suspect,
it was already broken.

2. I made a clean bootstrap using system compiler. It compiles stage1 and
stage2. The stage2 ends up with cpp errors.

3. The reason for these errors is, traditonal variable is clobbered. It
happens in cpp in the _first_ call to xmalloc.

  char **pend_files = (char **) xmalloc (argc * sizeof (char *));

The value traditional gets, is argument to xmalloc + 1 (I can provide gdb
session to prove it :-) Before call to malloc() traditional is zero, after
return from malloc() traditional is clobbered.

Now I am lost. I have no idea, what possibly can happen. I provide here two
asm's of xmalloc - one produced by stage1 gcc and another by our native
compiler.

4. System information:

SINIX-L 5.41D20 with all fixes available. The system is based on original
AT&T SVR4.0 The hardware is i486 based system - _not_ IBM PC.

I modified xmalloc to get rid of register (hoping, that was the problem)
without any luck. xmalloc() looks now like:

GENERIC_PTR
xmalloc (size)
     size_t size;
{
  GENERIC_PTR ptr;
  ptr = (GENERIC_PTR) malloc (size);
  if (!ptr)
    memory_full ();
  return ptr;
}

stage1 xgcc xmalloc (-O2 -g -DIN_GCC)

.L_D1654:
        .4byte  0x4
        .previous
        .align 4
.globl xmalloc
        .type    xmalloc,@function
xmalloc:
.L_LC4517:

        .section        .line
        .4byte  10355   / cccp.c:10355
        .2byte  0xffff
        .4byte  .L_LC4517-.L_text_b
        .previous
.L_b120:
.L_B255:
        pushl %ebp
        movl %esp,%ebp
.L_LC4518:

        .section        .line
        .4byte  10357   / cccp.c:10357
        .previous
        pushl 8(%ebp)
        call malloc
.L_LC4519:

        .section        .line
        .4byte  10358   / cccp.c:10358
        .2byte  0xffff
        .4byte  .L_LC4519-.L_text_b
        .previous
        addl $4,%esp
        testl %eax,%eax
        jne .L3786
.L_LC4520:

        .section        .line
        .4byte  10359   / cccp.c:10359
        .2byte  0xffff
        .4byte  .L_LC4520-.L_text_b
        .previous
        call memory_full
        .align 4
.L3786:
.L_LC4521:

        .section        .line
        .4byte  10361   / cccp.c:10361
        .2byte  0xffff
        .4byte  .L_LC4521-.L_text_b
        .previous
.L_B255_e:
        leave
        ret
.L_b120_e:
.L_f120_e:
.Lfe120:

(debug info follows)


xmalloc from local cc (-g -DIN_GCC)


        public  _xmalloc
_xmalloc:
        symdecl '_xmalloc','X','()*V',_xmalloc
        push    ebp
        mov     ebp,esp
        sub     esp,?F1021
        push    ebx
        push    esi
        push    edi
        begfnc  '_xmalloc'
; SCPARAM: size, offset 8
        symdecl 'size','P','IUI',[ebp+8]
; SCAUTO:  ptr, offset -4
        symdecl 'ptr','A','*V',[ebp-4]
        setline 10357
        mov     eax,dword ptr [ebp+8]
        push    eax
        call    _malloc
        mov     dword ptr [ebp-4],eax
        setline 10358
        mov     eax,dword ptr [ebp-4]
        or      eax,eax
        lea     esp,[esp+4]
        jne     ?M2918
        setline 10359
        call    _memory_full
?M2918:
        setline 10360
        mov     eax,dword ptr [ebp-4]
?X1021:
        pop     edi
        pop     esi
        pop     ebx
        mov     esp,ebp
        pop     ebp
        ret
        endfnc
?A1021  equ     -4
?F1021  equ     4
        size    _xmalloc,$-_xmalloc
        align   4


TIA

Merry Christmas to everybody

/andrej



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]