BUG in 2.95.3 - wrong asm code provokes an input variable to be nullified
Bernd Schmidt
bernds@redhat.com
Tue Jun 19 06:05:00 GMT 2001
On Thu, 14 Jun 2001, Maxime Austruy wrote:
> In certain conditions (still not clear) gcc overwrites a parameter
> given to a function. The attached file is the preprocessed (ready
> to be compiled) file which generates the error.
This happens because regmove munges an insn carrying a REG_EQUIV note
without updating the note. I'm currently testing the following patch,
and I'll check it in on the 2.95 branch and the mainline once the tests
have completed. This should be a candidate for 3.0.1 as well.
Bernd
* regmove.c (optimize_reg_copy_3): Do nothing if previous insn
carries a REG_EQUIV note. If it carries REG_EQUAL, delete the
note.
Index: regmove.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/regmove.c,v
retrieving revision 1.59.4.1
diff -u -p -r1.59.4.1 regmove.c
--- regmove.c 1999/10/12 05:44:39 1.59.4.1
+++ regmove.c 2001/06/19 12:46:45
@@ -693,6 +693,9 @@ optimize_reg_copy_3 (insn, dest, src)
}
if (! (set = single_set (p))
|| GET_CODE (SET_SRC (set)) != MEM
+ /* If there's a REG_EQUIV note, this must be an insn that loads an
+ argument. Prefer keeping the note over doing this optimization. */
+ || find_reg_note (p, REG_EQUIV, NULL_RTX)
|| SET_DEST (set) != src_reg)
return;
@@ -736,6 +739,12 @@ optimize_reg_copy_3 (insn, dest, src)
/* One or more changes were no good. Back out everything. */
PUT_MODE (src_reg, old_mode);
XEXP (src, 0) = src_reg;
+ }
+ else
+ {
+ rtx note = find_reg_note (p, REG_EQUAL, NULL_RTX);
+ if (note)
+ remove_note (p, note);
}
}
More information about the Gcc-bugs
mailing list