make bootstrap segfaults on current cvs head (i686-pc-linux-gnu)

Alan Modra alan@linuxcare.com.au
Fri Oct 13 18:48:00 GMT 2000


On 13 Oct 2000, Mike Coleman wrote:

> "Joseph S. Myers" <jsm28@cam.ac.uk> writes:
> > 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.  I tried
> > > 
> > > 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.  ...

Indeed.

> FWIW, I tried Alan's patch and it didn't affect the segfault for me.  (Thanks,
> though, Alan.)

Well, it did affect the segfault.  You just got a different one.  :-(
All due to wrong comparisons or conditional jumps being generated.

For this comparison in emit-rtl.c:gen_rtx_CONST_INT

  if (arg >= - MAX_SAVED_CONST_INT && arg <= MAX_SAVED_CONST_INT)
    return const_int_rtx[arg + MAX_SAVED_CONST_INT];

I see
   lea 0x40(%edx),%eax		; add MAX_SAVED_CONST_INT
   add $0xffffff80,%eax		; add -2*MAX_SAVED_CONST_INT
   ja
   <return const_int_rtx[] code>

"ja" branches if CF=0 and ZF=0, which is quite wrong.  Correct in this
case would be "jbe"

The patch I submitted fixes a real bug (gen_rtx_CONST_INT called in
init_emit_once before the CONST_INT hash has been created), which happened
to be exposed by one of these bad comparison bugs.

Alan
-- 
Linuxcare.  Support for the Revolution.



More information about the Gcc-bugs mailing list