This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Small problem in cse
- To: law at cygnus dot com
- Subject: Re: Small problem in cse
- From: chris at lslsun dot epfl dot ch (Christian Iseli)
- Date: Tue, 2 Dec 1997 16:10:29 +0100
- Cc: egcs at cygnus dot com
> Sorry, I meant to say why is classp->first_same_value NULL?
>
> From my review of the code I don't see that classp->first_same_value should
> ever be NULL -- thus I suspect something has gone wrong elsewhere that
> needs to be investigated.
>
> But I could be wrong, since you've got a target & testcase which triggers
> this problem you'll need to do some of the analysis.
Sorry for the long delay...
Turns out you were right, the problem was elsewhere.
Basically, the code around line 74xx in cse.c tries to find some
equivalence in the table and then sets classp to be the
first_same_value of the equivalence chain. However, no check was
done to ensure that this first_same_value was valid. So when
remove_invalid_refs was called later, the element pointed to by
classp was deleted, leading to trouble...
The following patch cures the problem (I hope :-)
Cheers,
Christian
Tue Dec 2 16:07:45 1997 Christian Iseli <Christian.Iseli@lslsun.epfl.ch>
* cse.c (cse_insn): Check for invalid entries when taking references.
*** cse.c~ Mon Nov 17 07:50:55 1997
--- cse.c Tue Dec 2 15:49:50 1997
*************** cse_insn (insn, in_libcall_block)
*** 7428,7433 ****
--- 7428,7438 ----
merge_equiv_classes (src_elt, classp);
classp = src_elt->first_same_value;
+ /* Ignore invalid entries. */
+ while (classp
+ && GET_CODE (classp->exp) != REG
+ && ! exp_equiv_p (classp->exp, classp->exp, 1, 0))
+ classp = classp->next_same_value;
}
}
}