]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport "[openacc] Fix ICE when compiling tile loop containing infinite loop"
authorTom de Vries <tom@codesourcery.com>
Tue, 1 May 2018 13:21:19 +0000 (13:21 +0000)
committerTom de Vries <vries@gcc.gnu.org>
Tue, 1 May 2018 13:21:19 +0000 (13:21 +0000)
2018-05-01  Tom de Vries  <tom@codesourcery.com>

backport from trunk:
2018-04-16  Cesar Philippidis  <cesar@codesourcery.com>
    Tom de Vries  <tom@codesourcery.com>

PR middle-end/84955
* omp-expand.c (expand_oacc_for): Add dummy false branch for
tiled basic blocks without omp continue statements.

* testsuite/libgomp.oacc-c-c++-common/pr84955.c: New test.
* testsuite/libgomp.oacc-fortran/pr84955.f90: New test.

From-SVN: r259795

gcc/ChangeLog
gcc/omp-expand.c
libgomp/ChangeLog
libgomp/testsuite/libgomp.oacc-c-c++-common/pr84955.c [new file with mode: 0644]
libgomp/testsuite/libgomp.oacc-fortran/pr84955.f90 [new file with mode: 0644]

index 42bb3021c040e582a7a4ca17c970eb307b5cee68..12413cc3c3cf684db49712c1bf0eb3af710fbe80 100644 (file)
@@ -1,3 +1,13 @@
+2018-05-01  Tom de Vries  <tom@codesourcery.com>
+
+       backport from trunk:
+       2018-04-16  Cesar Philippidis  <cesar@codesourcery.com>
+                   Tom de Vries  <tom@codesourcery.com>
+
+       PR middle-end/84955
+       * omp-expand.c (expand_oacc_for): Add dummy false branch for
+       tiled basic blocks without omp continue statements.
+
 2018-04-26  Richard Biener  <rguenther@suse.de>
 
        Backport from mainline
index a1e668d99d225e54312d4fa876a8aa0b474b2e6c..549a5db000a44b4eebf4d1740312c520d510bbf8 100644 (file)
@@ -5628,6 +5628,14 @@ expand_oacc_for (struct omp_region *region, struct omp_for_data *fd)
 
          split->flags ^= EDGE_FALLTHRU | EDGE_TRUE_VALUE;
 
+         /* Add a dummy exit for the tiled block when cont_bb is missing.  */
+         if (cont_bb == NULL)
+           {
+             edge e = make_edge (body_bb, exit_bb, EDGE_FALSE_VALUE);
+             e->probability = PROB_EVEN;
+             split->probability = PROB_EVEN;
+           }
+
          /* Initialize the user's loop vars.  */
          gsi = gsi_start_bb (elem_body_bb);
          expand_oacc_collapse_vars (fd, true, &gsi, counts, e_offset);
index c3a640a0689b0a58e9adf7b2277e2d9314bf50db..cc463532157128ea57436c326b6d717964ed1e2f 100644 (file)
@@ -1,3 +1,13 @@
+2018-05-01  Tom de Vries  <tom@codesourcery.com>
+
+       backport from trunk:
+       2018-04-16  Cesar Philippidis  <cesar@codesourcery.com>
+                   Tom de Vries  <tom@codesourcery.com>
+
+       PR middle-end/84955
+       * testsuite/libgomp.oacc-c-c++-common/pr84955.c: New test.
+       * testsuite/libgomp.oacc-fortran/pr84955.f90: New test.
+
 2018-03-03  Jakub Jelinek  <jakub@redhat.com>
 
        Backported from mainline
diff --git a/libgomp/testsuite/libgomp.oacc-c-c++-common/pr84955.c b/libgomp/testsuite/libgomp.oacc-c-c++-common/pr84955.c
new file mode 100644 (file)
index 0000000..e528faa
--- /dev/null
@@ -0,0 +1,15 @@
+/* { dg-do compile }  */
+
+int
+main (void)
+{
+  int i, j;
+
+#pragma acc parallel loop tile(2,3)
+  for (i = 1; i < 10; i++)
+    for (j = 1; j < 10; j++)
+      for (;;)
+       ;
+
+  return i + j;
+}
diff --git a/libgomp/testsuite/libgomp.oacc-fortran/pr84955.f90 b/libgomp/testsuite/libgomp.oacc-fortran/pr84955.f90
new file mode 100644 (file)
index 0000000..dc85865
--- /dev/null
@@ -0,0 +1,13 @@
+! { dg-do compile }
+
+subroutine s
+   integer :: i, j
+   !$acc parallel loop tile(2,3)
+   do i = 1, 10
+      do j = 1, 10
+         do
+         end do
+      end do
+   end do
+  !$acc end parallel loop
+end subroutine s