]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
backport: re PR fortran/71717 (A gfortran silent "wrong code" bug in the transition...
authorJakub Jelinek <jakub@redhat.com>
Thu, 7 Jul 2016 21:55:37 +0000 (23:55 +0200)
committerJakub Jelinek <jakub@gcc.gnu.org>
Thu, 7 Jul 2016 21:55:37 +0000 (23:55 +0200)
Backported from mainline
2016-07-01  Jakub Jelinek  <jakub@redhat.com>

PR fortran/71717
* trans-openmp.c (gfc_omp_privatize_by_reference): Return false
for GFC_DECL_ASSOCIATE_VAR_P with POINTER_TYPE.

* testsuite/libgomp.fortran/associate3.f90: New test.

From-SVN: r238148

gcc/fortran/ChangeLog
gcc/fortran/trans-openmp.c
libgomp/ChangeLog
libgomp/testsuite/libgomp.fortran/associate3.f90 [new file with mode: 0644]

index 1dd8d04e85ea5d2e3d7b3546e6f319bd51ec71fe..d1f479ba24a29a6f10af68675bb2d650855195a2 100644 (file)
@@ -1,6 +1,12 @@
 2016-07-07  Jakub Jelinek  <jakub@redhat.com>
 
        Backported from mainline
+       2016-07-01  Jakub Jelinek  <jakub@redhat.com>
+
+       PR fortran/71717
+       * trans-openmp.c (gfc_omp_privatize_by_reference): Return false
+       for GFC_DECL_ASSOCIATE_VAR_P with POINTER_TYPE.
+
        2016-06-30  Jakub Jelinek  <jakub@redhat.com>
 
        PR fortran/71704
index 08e461e4e72c3a8b6d7075916ec1da2c1a070aa2..ab8641bafe320350cf2f240eb14763686b418392 100644 (file)
@@ -59,6 +59,7 @@ gfc_omp_privatize_by_reference (const_tree decl)
       if (GFC_DECL_GET_SCALAR_POINTER (decl)
          || GFC_DECL_GET_SCALAR_ALLOCATABLE (decl)
          || GFC_DECL_CRAY_POINTEE (decl)
+         || GFC_DECL_ASSOCIATE_VAR_P (decl)
          || VOID_TYPE_P (TREE_TYPE (TREE_TYPE (decl))))
        return false;
 
index 7749bb26e01aa52de6b8f0a4d1123a91c79d1240..f5e93b3c66fb4ab05cd88a16466e2c82574cd344 100644 (file)
@@ -1,3 +1,11 @@
+2016-07-07  Jakub Jelinek  <jakub@redhat.com>
+
+       Backported from mainline
+       2016-07-01  Jakub Jelinek  <jakub@redhat.com>
+
+       PR fortran/71717
+       * testsuite/libgomp.fortran/associate3.f90: New test.
+
 2016-02-16  Tom de Vries  <tom@codesourcery.com>
 
        backport from trunk:
diff --git a/libgomp/testsuite/libgomp.fortran/associate3.f90 b/libgomp/testsuite/libgomp.fortran/associate3.f90
new file mode 100644 (file)
index 0000000..ec3d8dc
--- /dev/null
@@ -0,0 +1,20 @@
+! PR fortran/71717
+! { dg-do run }
+
+  type t
+    real, allocatable :: f(:)
+  end type
+  type (t) :: v
+  integer :: i, j
+  allocate (v%f(4))
+  v%f = 19.
+  i = 5
+  associate (u => v, k => i)
+  !$omp parallel do
+  do j = 1, 4
+    u%f(j) = 21.
+    if (j.eq.1) k = 7
+  end do
+  end associate
+  if (any (v%f(:).ne.21.) .or. i.ne.7) call abort
+end