recursive rtl bug
Bernd Schmidt
bernds@balti.cygnus.co.uk
Mon Dec 13 07:11:00 GMT 1999
On Tue, 23 Nov 1999, Tom Truscott wrote:
> I reported this SEGV a while back, but alas it is still happening:
> GNU C version 2.96 19991122 (experimental) (i686-pc-linux-gnu)
>
> /* "gcc -O foo.c" gets a SEGV */
> void foo(double bar[], double *zp, int n)
> {
> int i, j;
>
> i = 0;
> for(j = 0; j < n; j++)
> {
> i += j+1;
> bar[i] *= (1.0 + *zp);
> }
> }
>
> Here is some rudimentary debugging that might help.
> A self-referent rtl is created, which can be trapped with:
Here's a patch to fix it. The problem is that we're generating shared rtl
in combine. Later, we substitute in one expression and the other one
gets magically changed as well.
Bernd
* combine.c (combine_simplify_rtx): Don't create shared rtl.
Index: combine.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/combine.c,v
retrieving revision 1.102
diff -c -p -r1.102 combine.c
*** combine.c 1999/12/12 01:34:39 1.102
--- combine.c 1999/12/13 14:57:29
*************** combine_simplify_rtx (x, op0_mode, last,
*** 4190,4196 ****
gen_binary (MULT, mode,
XEXP (XEXP (x, 0), 0), XEXP (x, 1)),
gen_binary (MULT, mode,
! XEXP (XEXP (x, 0), 1), XEXP (x, 1))));
if (GET_CODE (x) != MULT)
return x;
--- 4190,4197 ----
gen_binary (MULT, mode,
XEXP (XEXP (x, 0), 0), XEXP (x, 1)),
gen_binary (MULT, mode,
! XEXP (XEXP (x, 0), 1),
! copy_rtx (XEXP (x, 1)))));
if (GET_CODE (x) != MULT)
return x;
More information about the Gcc-patches
mailing list