This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Patch for [Bug fortran/81841] [5/6/7/8 Regression] THREADPRIVATE (OpenMP) wrongly rejected in BLOCK DATA
- From: Jakub Jelinek <jakub at redhat dot com>
- To: dbroemmel <dibr-bugzilla at daswigwam dot de>
- Cc: fortran at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org
- Date: Thu, 23 Nov 2017 21:21:58 +0100
- Subject: Re: Patch for [Bug fortran/81841] [5/6/7/8 Regression] THREADPRIVATE (OpenMP) wrongly rejected in BLOCK DATA
- Authentication-results: sourceware.org; auth=none
- References: <2f2d738f-90d7-0efe-1caf-7e3a6387b0eb@daswigwam.de> <20170901120842.GJ2323@tucnak> <a7154299-b247-86ef-8c99-c4c508e9f7c3@daswigwam.de> <20170901131124.GK2323@tucnak> <b5aceaab-186c-9da7-654f-9d45bc6ea783@daswigwam.de>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Fri, Sep 01, 2017 at 03:47:10PM +0200, dbroemmel wrote:
> > If you really need a testcase, it would be enough to do something like:
> > use omp_lib
> > !$omp parallel num_threads(2)
> > int2 = omp_get_thread_num ()
> > !$omp barrier
> > if (int2 != omp_get_thread_num ()) call abort
> > !$omp end parallel
> > or so to ensure it has the threadprivate property by writing something
> > different to it in each thread and after barrier verifying it has the
> > expected value in each thread.
> I'm more than fine with the short compile-only testcase. I pretty sure
> my largish runtime test doesn't get near covering all relevant aspects
> of the THREADPRIVATE directive for common blocks. Also, the fix is for
> this reject-valid parsing error, so not really to do with anything else,
> so perhaps shouldn't test anything else?
I was expecting you'd repost the patch with updated testcase and then
forgot about the issue, got to it only now when looking through regressions.
I've bootstrapped/regtested this version and committed it so far to trunk:
2017-11-23 Dirk Broemmel <dibr-bugzilla@daswigwam.de>
Jakub Jelinek <jakub@redhat.com>
PR fortran/81841
* parse.c (parse_spec): Allow ST_OMP_THREADPRIVATE inside of
BLOCK DATA.
* libgomp.fortran/pr81841.f90: New test.
--- gcc/fortran/parse.c.jj 2017-11-06 08:46:32.000000000 +0100
+++ gcc/fortran/parse.c 2017-11-23 18:40:44.727973342 +0100
@@ -3699,6 +3699,7 @@ loop:
case ST_EQUIVALENCE:
case ST_IMPLICIT:
case ST_IMPLICIT_NONE:
+ case ST_OMP_THREADPRIVATE:
case ST_PARAMETER:
case ST_STRUCTURE_DECL:
case ST_TYPE:
--- libgomp/testsuite/libgomp.fortran/pr81841.f90.jj 2017-11-23 18:34:37.319385141 +0100
+++ libgomp/testsuite/libgomp.fortran/pr81841.f90 2017-11-23 18:44:36.055198860 +0100
@@ -0,0 +1,26 @@
+! PR fortran/81841
+! { dg-do run }
+
+block data
+ integer :: a
+ real :: b(2)
+ common /c/ a, b
+ !$omp threadprivate (/c/)
+ data a / 32 /
+ data b /2*1./
+end
+
+program pr81841
+ use omp_lib
+ integer :: e
+ real :: f(2)
+ common /c/ e, f
+ !$omp threadprivate (/c/)
+ !$omp parallel num_threads(8)
+ if ((e /= 32) .or. any(f /= 1.)) call abort
+ e = omp_get_thread_num ()
+ f = e + 19.
+ !$omp barrier
+ if ((e /= omp_get_thread_num ()) .or. any(f /= e + 19.)) call abort
+ !$omp end parallel
+end
Jakub