Blame SOURCES/gcc48-pr52714.patch

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