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-bugzi...@daswigwam.de> Jakub Jelinek <ja...@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