make bootstrap segfaults on current cvs head (i686-pc-linux-gnu)
Zack Weinberg
zackw@stanford.edu
Fri Oct 13 17:01:00 GMT 2000
On Fri, Oct 13, 2000 at 11:59:20PM +0100, Joseph S. Myers wrote:
> On Fri, 13 Oct 2000, Alan Modra wrote:
>
> > On Fri, 13 Oct 2000, Mike Coleman wrote:
> >
> > > I get a segfault when trying to build gcc from the current cvs
> > > head.
> >
> > So do I. This might help.
> >
> > gcc/ChangeLog
> > * emit_rtl.c (init_emit_once): Create const_int_htab before using.
>
> I think there's more to the problem than this. gen_rtx_CONST_INT is at
> this point only called with values that shouldn't go to const_int_htab -
> arg == 0 at the crash. It seems that
Here's an assembly dump. The problematic sequence is starred.
gen_rtx_CONST_INT:
push %ebp
mov %esp, %ebp
push %ebx
sub $4, %esp
mov 10(%ebp), %edx ; arg in edx
* lea 64(%edx), %eax ; arg+MAX_SAVED_CONST_INT in eax
* add $-128, %eax ; subtract 2*MAX_SAVED_CONST_INT
* ja .L2 ; if positive, not in const_int_rtx[]
mov const_int_rtx(%edx,4), %eax ; else fetch
.L1:
mov -4(%ebp), %ebx
mov %ebp, %esp
pop %ebp
ret
.L2:
<code to look stuff up in const_int_htab>
We're called with arg=0. That becomes 64 in %eax, and then we
subtract 128 from that, giving -64. The condition codes are set
'according to the result' - in this case, that means SF on, all others
off. JA jumps if "above: CF=0 and ZF=0", which both are.
That add needs to be a compare, instead. I think we decided to
convert <sub $128, %eax> into <add $-128, %eax> because it's smaller
that way (+128 doesn't fit into a signed byte, -128 does) without
considering that add and sub do different things to the flags. From
the debugger, I adjusted the add instruction into a compare against
+127, which fits in the same 3 bytes, and cc1 successfully finished
processing tmp-dum.c.
zw
More information about the Gcc-bugs
mailing list