]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR fortran/77666 (ICE in gfc_omp_clause_default_ctor, at fortran/trans...
authorJakub Jelinek <jakub@redhat.com>
Tue, 30 May 2017 07:29:49 +0000 (09:29 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Tue, 30 May 2017 07:29:49 +0000 (09:29 +0200)
Backported from mainline
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.

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

From-SVN: r248613

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

index c21acd8a345fd7d1e371c72fd3745cf3a9ac700c..0a90013c167dc9c3eefc79e834954f0c6fa54fe9 100644 (file)
@@ -1,6 +1,12 @@
 2017-05-30  Jakub Jelinek  <jakub@redhat.com>
 
        Backported from mainline
+       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-08  Jakub Jelinek  <jakub@redhat.com>
 
        PR fortran/77500
index e2182f62d2623b4cdfb8279a030aa63fc6d04998..906781d9b8389bd6b72819f8c72b5bdb4a0c70ac 100644 (file)
@@ -217,6 +217,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;
@@ -224,9 +227,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 01905bceff81bce1fbd5db3233da669f3f295a20..092fd3c709a3fe387ec3e0341f3c0b61e17eccc5 100644 (file)
@@ -1,6 +1,11 @@
 2017-05-30  Jakub Jelinek  <jakub@redhat.com>
 
        Backported from mainline
+       2016-09-27  Jakub Jelinek  <jakub@redhat.com>
+
+       PR fortran/77666
+       * gfortran.dg/gomp/pr77666.f90: New test.
+
        2016-09-22  Jakub Jelinek  <jakub@redhat.com>
 
        PR fortran/77665
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