diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index e16650b2349f525059437d6e3e9a14491be7bcac..64ec00307f4523b5e8c335c3bb5e0389f637af04 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2012-01-31  Jakub Jelinek  <jakub@redhat.com>
+
+	PR bootstrap/52058
+	* combine.c (do_SUBST_LINK, SUBST_LINK): Guard with #ifndef HAVE_cc0.
+
 2012-01-31  Andreas Krebbel  <Andreas.Krebbel@de.ibm.com>
 
 	* config/s390/s390.md ("*ashr<mode>3_and"): Add missing z196 flag
diff --git a/gcc/combine.c b/gcc/combine.c
index 1e01c87cedef1c72f382310be7712095f43df858..beb980b3570510f0a65986a5c1c9496e33350b16 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -790,6 +790,7 @@ do_SUBST_MODE (rtx *into, enum machine_mode newval)
 
 #define SUBST_MODE(INTO, NEWVAL)  do_SUBST_MODE(&(INTO), (NEWVAL))
 
+#ifndef HAVE_cc0
 /* Similar to SUBST, but NEWVAL is a LOG_LINKS expression.  */
 
 static void
@@ -815,7 +816,7 @@ do_SUBST_LINK (struct insn_link **into, struct insn_link *newval)
 }
 
 #define SUBST_LINK(oldval, newval) do_SUBST_LINK (&oldval, newval)
-
+#endif
 
 /* Subroutine of try_combine.  Determine whether the replacement patterns
    NEWPAT, NEWI2PAT and NEWOTHERPAT are cheaper according to insn_rtx_cost