--- gcc/combine.cc.jj	2026-01-02 09:56:09.924340621 +0100
+++ gcc/combine.cc	2026-01-06 19:34:48.689525955 +0100
@@ -4028,7 +4028,7 @@ try_combine (rtx_insn *i3, rtx_insn *i2,
 	       && !(GET_CODE (SET_DEST (set1)) == SUBREG
 		    && find_reg_note (i2, REG_DEAD,
 				      SUBREG_REG (SET_DEST (set1))))
-	       && SET_DEST (set1) != pc_rtx
+	       && !modified_between_p (SET_DEST (set1), i2, i3)
 	       && !reg_used_between_p (SET_DEST (set1), i2, i3)))
 	  /* If I3 is a jump, ensure that set0 is a jump so that
 	     we do not create invalid RTL.  */
@@ -4044,7 +4044,7 @@ try_combine (rtx_insn *i3, rtx_insn *i2,
 		    && !(GET_CODE (SET_DEST (set0)) == SUBREG
 			 && find_reg_note (i2, REG_DEAD,
 					   SUBREG_REG (SET_DEST (set0))))
-		    && SET_DEST (set0) != pc_rtx
+		    && !modified_between_p (SET_DEST (set0), i2, i3)
 		    && !reg_used_between_p (SET_DEST (set0), i2, i3)))
 	       /* If I3 is a jump, ensure that set1 is a jump so that
 		  we do not create invalid RTL.  */
