re PR tree-optimization/71328 (ice in verify_jump_thread)
authorJeff Law <law@redhat.com>
Fri, 3 Jun 2016 05:20:16 +0000 (23:20 -0600)
committerJeff Law <law@gcc.gnu.org>
Fri, 3 Jun 2016 05:20:16 +0000 (23:20 -0600)
PR tree-optimization/71328
* tree-ssa-threadupdate.c (duplicate_thread_path): Fix off-by-one
error when checking for a jump back onto the copied path.  */

PR tree-optimization/71328
* gcc.c-torture/compile/pr71328.c: New test.

From-SVN: r237052

gcc/ChangeLog
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.c-torture/compile/pr71328.c [new file with mode: 0644]
gcc/tree-ssa-threadupdate.c

index 2a0951bfe96aa3268c18e0866e582c7289a7196b..2c6f6b12cc5d93a8da64bd4fb037bcfede322480 100644 (file)
@@ -1,3 +1,9 @@
+2016-06-02  Jeff Law  <law@redhat.com>
+
+       PR tree-optimization/71328
+       * tree-ssa-threadupdate.c (duplicate_thread_path): Fix off-by-one
+       error when checking for a jump back onto the copied path.  */
+
 2016-06-02  David Malcolm  <dmalcolm@redhat.com>
 
        * config/microblaze/microblaze.c (get_branch_target): Add return
index 9f7da169de637d334f6fcf12bb5dbdb490880c2e..263d91b585ba0a309ff452c7c65184ee4669d4e7 100644 (file)
@@ -1,3 +1,8 @@
+2016-06-02  Jeff Law  <law@redhat.com>
+
+       PR tree-optimization/71328
+       * gcc.c-torture/compile/pr71328.c: New test.
+
 2016-06-02  Jerry DeLisle  <jvdelisle@gcc.gnu.org>
 
        PR fortran/52393
diff --git a/gcc/testsuite/gcc.c-torture/compile/pr71328.c b/gcc/testsuite/gcc.c-torture/compile/pr71328.c
new file mode 100644 (file)
index 0000000..aa384e8
--- /dev/null
@@ -0,0 +1,16 @@
+
+
+int a, b, c;
+void fn1() {
+  unsigned char d = 3;
+  if (d > 11)
+  lbl_596:
+  c = 0;
+  while (!d)
+    b = b;
+  unsigned char e = e || d;
+  d = e;
+  if (a)
+    d = d || a;
+  goto lbl_596;
+}
index 620948c254e35358ec6350e6e07139da2a44467d..1ff007a495a1c3c9e504ac11b12bcc81013089a6 100644 (file)
@@ -2298,11 +2298,11 @@ duplicate_thread_path (edge entry, edge exit,
        }
 
       /* Special case the last block on the path: make sure that it does not
-        jump back on the copied path.  */
+        jump back on the copied path, including back to itself.  */
       if (i + 1 == n_region)
        {
          FOR_EACH_EDGE (e, ei, bb->succs)
-           if (bb_in_bbs (e->dest, region_copy, n_region - 1))
+           if (bb_in_bbs (e->dest, region_copy, n_region))
              {
                basic_block orig = get_bb_original (e->dest);
                if (orig)