From a8dbab92f0f397bd4b5f5a8d4fc08823006151be Mon Sep 17 00:00:00 2001 From: Jakub Jelinek Date: Fri, 1 Jul 2016 17:13:28 +0200 Subject: [PATCH] re PR fortran/71717 (A gfortran silent "wrong code" bug in the transition from 4.9.0 -> 4.9.1, using OpenMP.) 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: r237916 --- gcc/fortran/ChangeLog | 6 ++++++ gcc/fortran/trans-openmp.c | 1 + libgomp/ChangeLog | 5 +++++ .../testsuite/libgomp.fortran/associate3.f90 | 20 +++++++++++++++++++ 4 files changed, 32 insertions(+) create mode 100644 libgomp/testsuite/libgomp.fortran/associate3.f90 diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index e399d359126..406a3822bde 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,9 @@ +2016-07-01 Jakub Jelinek + + 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 PR fortran/71704 diff --git a/gcc/fortran/trans-openmp.c b/gcc/fortran/trans-openmp.c index b005d392f47..0d646edca11 100644 --- a/gcc/fortran/trans-openmp.c +++ b/gcc/fortran/trans-openmp.c @@ -61,6 +61,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; diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog index 22049107af1..41bc67c1157 100644 --- a/libgomp/ChangeLog +++ b/libgomp/ChangeLog @@ -1,3 +1,8 @@ +2016-07-01 Jakub Jelinek + + PR fortran/71717 + * testsuite/libgomp.fortran/associate3.f90: New test. + 2016-06-17 Jakub Jelinek * testsuite/libgomp.c++/target-21.C: New test. diff --git a/libgomp/testsuite/libgomp.fortran/associate3.f90 b/libgomp/testsuite/libgomp.fortran/associate3.f90 new file mode 100644 index 00000000000..ec3d8dc33b9 --- /dev/null +++ b/libgomp/testsuite/libgomp.fortran/associate3.f90 @@ -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 -- 2.30.2