Subject: Re: compiler bug (egcs-1.1.2)
To: Krister Walfridsson <cato@df.lth.se>
From: Matthias Drochner <drochner@zel459.zel.kfa-juelich.de>
List: tech-toolchain
Date: 08/27/1999 17:21:44
cato@df.lth.se said:
> This problem is present for most (all?) archs, and has been for a long
> time (at least since gcc-2.7) 

The egcs people came up with the appended fix. The log message is
        * combine.c (get_last_value): Don't look for earlier sets if the last
        known set is somewhere in between the insns being combined.
(see http://egcs.cygnus.com/ml/gcc/1999-08/msg00760.html)

Just tried - it makes the test program work correctly on i386 and mipsel.
Should it be applied to our tree (and perhaps to the release branch(es))?

best regards
Matthias


Index: combine.c
===================================================================
RCS file: /cvsroot/gnusrc/gnu/dist/gcc/combine.c,v
retrieving revision 1.1.1.3
diff -u -p -r1.1.1.3 combine.c
--- combine.c	1999/04/06 15:07:39	1.1.1.3
+++ combine.c	1999/08/27 15:07:17
@@ -10824,6 +10824,11 @@ get_last_value (x)
     {
       rtx insn, set;
 
+      /* We can't do anything if the value is set in between the insns we are
+         processing.  */
+      if (INSN_CUID (reg_last_set[regno]) <= INSN_CUID (subst_insn))
+        return 0;
+
       /* We can not do anything useful in this case, because there is
 	 an instruction which is not on the insn chain.  */
       if (subst_prev_insn)