This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Biv detection take 2
- To: Jan Hubicka <hubicka at atrey dot karlin dot mff dot cuni dot cz>
- Subject: Re: Biv detection take 2
- From: grahams <grahams at rcp dot co dot uk>
- Date: Thu, 20 Apr 2000 20:54:50 +0100
- CC: egcs-patches at egcs dot cygnus dot com, rth at cygnus dot com
- References: <20000415213546.B713@atrey.karlin.mff.cuni.cz>
Jan
This patch has bug if seq is a zero length SEQUNCE. The problem is
the following
last = XVECEXP (seq, 0, i - 1);
If seq is a zero length SEQUENCE then the above is accessing element
-1 (i.e. i is 0) which is wrong. I believe a zero length SEQUENCE is
possible if no insns are emitted between the calls to start_sequence()
and gen_sequence().
graham
Jan Hubicka wrote:
>
> Hi
cut
> /* It is entirely possible that the expansion created lots of new
> registers. Iterate over the sequence we just created and
> *************** emit_iv_add_mult (b, m, a, reg, insert_b
> *** 8102,8115 ****
> int i;
> for (i = 0; i < XVECLEN (seq, 0); ++i)
> {
> ! rtx set = single_set (XVECEXP (seq, 0, i));
> if (set && GET_CODE (SET_DEST (set)) == REG)
> record_base_value (REGNO (SET_DEST (set)), SET_SRC (set), 0);
> }
> }
> ! else if (GET_CODE (seq) == SET
> ! && GET_CODE (SET_DEST (seq)) == REG)
> ! record_base_value (REGNO (SET_DEST (seq)), SET_SRC (seq), 0);
> }
>
> /* Test whether A * B can be computed without
> --- 8023,8069 ----
> int i;
> for (i = 0; i < XVECLEN (seq, 0); ++i)
> {
> ! set = single_set (XVECEXP (seq, 0, i));
> if (set && GET_CODE (SET_DEST (set)) == REG)
> record_base_value (REGNO (SET_DEST (set)), SET_SRC (set), 0);
> }
> + last = XVECEXP (seq, 0, i - 1);
> }
> ! else
> ! {
> cut