Blame SOURCES/gcc48-pr52714.patch

001c85
2014-02-27  Jeff Law  <law@redhat.com>
001c85
001c85
	PR rtl-optimization/52714
001c85
	* combine.c (try_combine): When splitting an unrecognized PARALLEL
001c85
	into two independent simple sets, if I3 is a jump, ensure the
001c85
	pattern we place into I3 is a (set (pc) ...)
001c85
001c85
	* gcc.c-torture/compile/pr52714.c: New test.
001c85
001c85
2016-06-15  Jakub Jelinek  <jakub@redhat.com>
001c85
001c85
	* gcc.c-torture/compile/20160615-1.c: New test.
001c85
001c85
--- gcc/combine.c	(revision 208203)
001c85
+++ gcc/combine.c	(revision 208204)
001c85
@@ -3706,6 +3706,9 @@ try_combine (rtx i3, rtx i2, rtx i1, rtx
001c85
 #ifdef HAVE_cc0
001c85
 	  && !reg_referenced_p (cc0_rtx, XVECEXP (newpat, 0, 0))
001c85
 #endif
001c85
+	  /* If I3 is a jump, ensure that set0 is a jump so that
001c85
+	     we do not create invalid RTL.  */
001c85
+	  && (!JUMP_P (i3) || SET_DEST (XVECEXP (newpat, 0, 0)) == pc_rtx)
001c85
 	 )
001c85
 	{
001c85
 	  newi2pat = XVECEXP (newpat, 0, 1);
001c85
@@ -3716,6 +3719,9 @@ try_combine (rtx i3, rtx i2, rtx i1, rtx
001c85
 #ifdef HAVE_cc0
001c85
 	       && !reg_referenced_p (cc0_rtx, XVECEXP (newpat, 0, 1))
001c85
 #endif
001c85
+	       /* If I3 is a jump, ensure that set1 is a jump so that
001c85
+		  we do not create invalid RTL.  */
001c85
+	       && (!JUMP_P (i3) || SET_DEST (XVECEXP (newpat, 0, 1)) == pc_rtx)
001c85
 	      )
001c85
 	{
001c85
 	  newi2pat = XVECEXP (newpat, 0, 0);
001c85
--- gcc/testsuite/gcc.c-torture/compile/pr52714.c	(revision 0)
001c85
+++ gcc/testsuite/gcc.c-torture/compile/pr52714.c	(revision 208204)
001c85
@@ -0,0 +1,25 @@
001c85
+
001c85
+int __re_compile_fastmap(unsigned char *p)
001c85
+{
001c85
+    unsigned char **stack;
001c85
+    unsigned size;
001c85
+    unsigned avail;
001c85
+
001c85
+    stack = __builtin_alloca(5 * sizeof(unsigned char*));
001c85
+    if (stack == 0)
001c85
+	return -2;
001c85
+    size = 5;
001c85
+    avail = 0;
001c85
+
001c85
+    for (;;) {
001c85
+	switch (*p++) {
001c85
+	case 0:
001c85
+	    if (avail == size)
001c85
+		return -2;
001c85
+	    stack[avail++] = p;
001c85
+	}
001c85
+    }
001c85
+
001c85
+    return 0;
001c85
+}
001c85
+
001c85
--- gcc/testsuite/gcc.c-torture/compile/20160615-1.c.jj	2016-06-15 11:17:54.690689056 +0200
001c85
+++ gcc/testsuite/gcc.c-torture/compile/20160615-1.c	2016-06-15 11:17:48.811765657 +0200
001c85
@@ -0,0 +1,10 @@
001c85
+int a;
001c85
+void bar (int, unsigned, unsigned);
001c85
+
001c85
+void
001c85
+foo (unsigned x)
001c85
+{
001c85
+  unsigned b = a ? x : 0;
001c85
+  if (x || b)
001c85
+    bar (0, x, b);
001c85
+}