re PR fortran/77666 (ICE in gfc_omp_clause_default_ctor, at fortran/trans-openmp...
authorJakub Jelinek <jakub@redhat.com>
Tue, 27 Sep 2016 07:52:28 +0000 (09:52 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Tue, 27 Sep 2016 07:52:28 +0000 (09:52 +0200)
PR fortran/77666
* trans-openmp.c (gfc_omp_private_outer_ref): Return true even for
references to allocatable arrays.

* gfortran.dg/gomp/pr77666.f90: New test.

From-SVN: r240522

gcc/fortran/ChangeLog
gcc/fortran/trans-openmp.c
gcc/testsuite/ChangeLog
gcc/testsuite/gfortran.dg/gomp/pr77666.f90 [new file with mode: 0644]

index c6bc662202b2d6839044776f37bdf4f33b5c0dc3..2aa7c69e3f68977db4705b63ba007a154c846ff9 100644 (file)
@@ -1,3 +1,9 @@
+2016-09-27  Jakub Jelinek  <jakub@redhat.com>
+
+       PR fortran/77666
+       * trans-openmp.c (gfc_omp_private_outer_ref): Return true even for
+       references to allocatable arrays.
+
 2016-09-26  Steven G. Kargl  <kargl@gcc.gnu.org>
 
        PR fortran/77420
index e4a2975719e6676e1bca804337b6a572d4024022..b8b8576f366e504dd63903a8c886348ad7ed474f 100644 (file)
@@ -207,6 +207,9 @@ gfc_omp_private_outer_ref (tree decl)
 {
   tree type = TREE_TYPE (decl);
 
+  if (gfc_omp_privatize_by_reference (decl))
+    type = TREE_TYPE (type);
+
   if (GFC_DESCRIPTOR_TYPE_P (type)
       && GFC_TYPE_ARRAY_AKIND (type) == GFC_ARRAY_ALLOCATABLE)
     return true;
@@ -214,9 +217,6 @@ gfc_omp_private_outer_ref (tree decl)
   if (GFC_DECL_GET_SCALAR_ALLOCATABLE (decl))
     return true;
 
-  if (gfc_omp_privatize_by_reference (decl))
-    type = TREE_TYPE (type);
-
   if (gfc_has_alloc_comps (type, decl))
     return true;
 
index 4b24d64eac4c43a952c16272f32d3dbac4680627..353fd073a0a64a8f3bbcbe59de5e6d560fa21392 100644 (file)
@@ -1,3 +1,8 @@
+2016-09-27  Jakub Jelinek  <jakub@redhat.com>
+
+       PR fortran/77666
+       * gfortran.dg/gomp/pr77666.f90: New test.
+
 2016-09-27  Kugan Vivekanandarajah  <kuganv@linaro.org>
 
        PR ipa/77677
diff --git a/gcc/testsuite/gfortran.dg/gomp/pr77666.f90 b/gcc/testsuite/gfortran.dg/gomp/pr77666.f90
new file mode 100644 (file)
index 0000000..18e039e
--- /dev/null
@@ -0,0 +1,26 @@
+! PR fortran/77666
+! { dg-do compile }
+
+subroutine foo(x)
+  interface
+    subroutine baz(x, y)
+      integer, allocatable :: x(:), y
+    end subroutine
+  end interface
+  integer, allocatable :: x(:), y
+!$omp parallel private(x, y)
+  call baz (x, y)
+!$omp end parallel
+end
+subroutine bar
+  interface
+    subroutine baz(x, y)
+      integer, allocatable :: x(:), y
+    end subroutine
+  end interface
+  integer, allocatable :: x(:), y
+  call baz (x, y)
+!$omp parallel private(x, y)
+  call baz (x, y)
+!$omp end parallel
+end