--- /dev/null
+--- gcc-4.0.0-20050417/gcc/reload.c.orig 2005-04-19 18:30:49.000000000 +0200
++++ gcc-4.0.0-20050417/gcc/reload.c 2005-04-19 18:30:52.000000000 +0200
+@@ -1520,7 +1520,7 @@ push_reload (rtx in, rtx out, rtx *inloc
+ But if there is no spilling in this block, that is OK.
+ An explicitly used hard reg cannot be a spill reg. */
+
+- if (rld[i].reg_rtx == 0 && in != 0)
++ if (rld[i].reg_rtx == 0 && in != 0 && hard_regs_live_known)
+ {
+ rtx note;
+ int regno;
+@@ -1534,6 +1534,9 @@ push_reload (rtx in, rtx out, rtx *inloc
+ && REG_P (XEXP (note, 0))
+ && (regno = REGNO (XEXP (note, 0))) < FIRST_PSEUDO_REGISTER
+ && reg_mentioned_p (XEXP (note, 0), in)
++ && (ORIGINAL_REGNO (XEXP (note, 0)) < FIRST_PSEUDO_REGISTER
++ || ! bitmap_bit_p (ENTRY_BLOCK_PTR->global_live_at_end,
++ ORIGINAL_REGNO (XEXP (note, 0))))
+ && ! refers_to_regno_for_reload_p (regno,
+ (regno
+ + hard_regno_nregs[regno]
+@@ -1997,7 +2000,16 @@ find_dummy_reload (rtx real_in, rtx real
+ is a subreg, and in that case, out
+ has a real mode. */
+ (GET_MODE (out) != VOIDmode
+- ? GET_MODE (out) : outmode)))
++ ? GET_MODE (out) : outmode))
++ /* But only do all this if we can be sure, that this input
++ operand doesn't correspond with an uninitialized pseudoreg.
++ global can assign some hardreg to it, which is the same as
++ a different pseudo also currently live (as it can ignore the
++ conflict). So we never must introduce writes to such hardregs,
++ as they would clobber the other live pseudo using the same. */
++ && (ORIGINAL_REGNO (in) < FIRST_PSEUDO_REGISTER
++ || ! bitmap_bit_p (ENTRY_BLOCK_PTR->global_live_at_end,
++ ORIGINAL_REGNO (in))))
+ {
+ unsigned int regno = REGNO (in) + in_offset;
+ unsigned int nwords = hard_regno_nregs[regno][inmode];
--- /dev/null
+===================================================================
+RCS file: /cvs/gcc/gcc/gcc/tree-ssa-pre.c,v
+retrieving revision 2.65.4.2
+retrieving revision 2.65.4.3
+diff -u -r2.65.4.2 -r2.65.4.3
+--- gcc/gcc/tree-ssa-pre.c 2005/04/17 23:40:31 2.65.4.2
++++ gcc/gcc/tree-ssa-pre.c 2005/04/25 14:02:31 2.65.4.3
+@@ -1330,7 +1330,8 @@
+
+ folded = fold (build (TREE_CODE (expr), TREE_TYPE (expr),
+ genop1, genop2));
+- newexpr = force_gimple_operand (folded, &forced_stmts, false, NULL);
++ newexpr = force_gimple_operand (unshare_expr (folded),
++ &forced_stmts, false, NULL);
+ if (forced_stmts)
+ {
+ tsi = tsi_start (forced_stmts);
+@@ -1372,14 +1373,8 @@
+ add_referenced_tmp_var (temp);
+ folded = fold (build (TREE_CODE (expr), TREE_TYPE (expr),
+ genop1));
+- /* If the generated operand is already GIMPLE min_invariant
+- just use it instead of calling force_gimple_operand on it,
+- since that may make it not invariant by copying it into an
+- assignment. */
+- if (!is_gimple_min_invariant (genop1))
+- newexpr = force_gimple_operand (folded, &forced_stmts, false, NULL);
+- else
+- newexpr = genop1;
++ newexpr = force_gimple_operand (unshare_expr (folded),
++ &forced_stmts, false, NULL);
+ if (forced_stmts)
+ {
+ tsi = tsi_start (forced_stmts);