Blame SOURCES/gcc48-rh1469697-20.patch

13f101
13f101
            * explow.c (anti_adjust_stack_and_probe_stack_clash): Avoid probing
13f101
            the red zone for stack_clash_protection_final_dynamic_probe targets
13f101
            when the total dynamic stack size is zero bytes.
13f101
    
13f101
diff -Nrup a/gcc/explow.c b/gcc/explow.c
13f101
--- a/gcc/explow.c	2017-11-14 23:33:15.403557607 -0700
13f101
+++ b/gcc/explow.c	2017-11-14 23:33:56.243239120 -0700
13f101
@@ -1934,6 +1934,13 @@ anti_adjust_stack_and_probe_stack_clash
13f101
   if (size != CONST0_RTX (Pmode)
13f101
       && targetm.stack_clash_protection_final_dynamic_probe (residual))
13f101
     {
13f101
+      /* SIZE could be zero at runtime and in that case *sp could hold
13f101
+	 live data.  Furthermore, we don't want to probe into the red
13f101
+	 zone.
13f101
+
13f101
+	 Go ahead and just guard a probe at *sp on SIZE != 0 at runtime
13f101
+	 if SIZE is not a compile time constant.  */
13f101
+
13f101
       /* Ideally we would just probe at *sp.  However, if SIZE is not
13f101
 	 a compile-time constant, but is zero at runtime, then *sp
13f101
 	 might hold live data.  So probe at *sp if we know that
13f101
@@ -1946,9 +1953,12 @@ anti_adjust_stack_and_probe_stack_clash
13f101
 	}
13f101
       else
13f101
 	{
13f101
-	  emit_stack_probe (plus_constant (Pmode, stack_pointer_rtx,
13f101
-					   -GET_MODE_SIZE (word_mode)));
13f101
+	  rtx label = gen_label_rtx ();
13f101
+	  emit_cmp_and_jump_insns (size, CONST0_RTX (GET_MODE (size)),
13f101
+				   EQ, NULL_RTX, Pmode, 1, label);
13f101
+	  emit_stack_probe (stack_pointer_rtx);
13f101
 	  emit_insn (gen_blockage ());
13f101
+	  emit_label (label);
13f101
 	}
13f101
     }
13f101
 }