From: Jakub Jelinek Date: Thu, 7 Jul 2016 21:55:37 +0000 (+0200) Subject: backport: re PR fortran/71717 (A gfortran silent "wrong code" bug in the transition... X-Git-Tag: releases/gcc-4.9.4~82 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1f159eb8463dee982eebc347076fd6bd7af5d881;p=thirdparty%2Fgcc.git backport: re PR fortran/71717 (A gfortran silent "wrong code" bug in the transition from 4.9.0 -> 4.9.1, using OpenMP.) Backported from mainline 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. * testsuite/libgomp.fortran/associate3.f90: New test. From-SVN: r238148 --- diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 1dd8d04e85ea..d1f479ba24a2 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,6 +1,12 @@ 2016-07-07 Jakub Jelinek Backported from mainline + 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 08e461e4e72c..ab8641bafe32 100644 --- a/gcc/fortran/trans-openmp.c +++ b/gcc/fortran/trans-openmp.c @@ -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; diff --git a/libgomp/ChangeLog b/libgomp/ChangeLog index 7749bb26e01a..f5e93b3c66fb 100644 --- a/libgomp/ChangeLog +++ b/libgomp/ChangeLog @@ -1,3 +1,11 @@ +2016-07-07 Jakub Jelinek + + Backported from mainline + 2016-07-01 Jakub Jelinek + + PR fortran/71717 + * testsuite/libgomp.fortran/associate3.f90: New test. + 2016-02-16 Tom de Vries backport from trunk: diff --git a/libgomp/testsuite/libgomp.fortran/associate3.f90 b/libgomp/testsuite/libgomp.fortran/associate3.f90 new file mode 100644 index 000000000000..ec3d8dc33b94 --- /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