On Thu, Nov 11, 2021 at 06:11:23PM +0100, Tobias Burnus wrote:
> --- a/gcc/fortran/parse.c
> +++ b/gcc/fortran/parse.c
> @@ -915,15 +915,16 @@ decode_omp_directive (void)
> matcho ("error", gfc_match_omp_error, ST_OMP_ERROR);
> matcho ("end atomic", gfc_match_omp_eos_error, ST_OMP_END_ATOMIC);
> matcho ("end critical", gfc_match_omp_end_critical,
> ST_OMP_END_CRITICAL);
> - matchs ("end distribute parallel do simd", gfc_match_omp_eos_error,
> + matchs ("end distribute parallel do simd", gfc_match_omp_end_nowait,
> ST_OMP_END_DISTRIBUTE_PARALLEL_DO_SIMD);
> - matcho ("end distribute parallel do", gfc_match_omp_eos_error,
> + matcho ("end distribute parallel do", gfc_match_omp_end_nowait,
I think the above two changes are incorrect.
At least looking at 5.1 which is clearer than 5.2, 5.1 [221:17-23] says
for C/C++ that while nowait is allowed on worksharing-loop, it is not
allowed on combined parallel worksharing-loop, and Fortran has that
restriction through the syntax (no [nowait] on !$omp end parallel do).
> @@ -936,9 +937,12 @@ decode_omp_directive (void)
> ST_OMP_END_MASTER_TASKLOOP);
> matcho ("end master", gfc_match_omp_eos_error, ST_OMP_END_MASTER);
> matchs ("end ordered", gfc_match_omp_eos_error, ST_OMP_END_ORDERED);
> - matchs ("end parallel do simd", gfc_match_omp_eos_error,
> + matchs ("end parallel do simd", gfc_match_omp_end_nowait,
> ST_OMP_END_PARALLEL_DO_SIMD);
> - matcho ("end parallel do", gfc_match_omp_eos_error,
> ST_OMP_END_PARALLEL_DO);
> + matcho ("end parallel do", gfc_match_omp_end_nowait,
> + ST_OMP_END_PARALLEL_DO);
Likewise for the above two.
> @@ -951,46 +955,53 @@ decode_omp_directive (void)
> ST_OMP_END_PARALLEL_MASTER_TASKLOOP);
> matcho ("end parallel master", gfc_match_omp_eos_error,
> ST_OMP_END_PARALLEL_MASTER);
> - matcho ("end parallel sections", gfc_match_omp_eos_error,
> + matcho ("end parallel sections", gfc_match_omp_end_nowait,
> ST_OMP_END_PARALLEL_SECTIONS);
> - matcho ("end parallel workshare", gfc_match_omp_eos_error,
> + matcho ("end parallel workshare", gfc_match_omp_end_nowait,
> ST_OMP_END_PARALLEL_WORKSHARE);
Ditto for the above two.
> matcho ("end parallel", gfc_match_omp_eos_error, ST_OMP_END_PARALLEL);
> matcho ("end scope", gfc_match_omp_end_nowait, ST_OMP_END_SCOPE);
> matcho ("end sections", gfc_match_omp_end_nowait, ST_OMP_END_SECTIONS);
> matcho ("end single", gfc_match_omp_end_single, ST_OMP_END_SINGLE);
> matcho ("end target data", gfc_match_omp_eos_error,
> ST_OMP_END_TARGET_DATA);
> - matchs ("end target parallel do simd", gfc_match_omp_eos_error,
> + matchs ("end target parallel do simd", gfc_match_omp_end_nowait,
The above seems like a bug in 5.1 standard, haven't checked 5.2.
!$omp end target parallel do simd nowait
should be IMO valid, but [241:16] mistakenly doesn't list it.
> ST_OMP_END_TARGET_PARALLEL_DO_SIMD);
> - matcho ("end target parallel do", gfc_match_omp_eos_error,
> + matcho ("end target parallel do", gfc_match_omp_end_nowait,
Similarly.
> ST_OMP_END_TARGET_PARALLEL_DO);
> - matcho ("end target parallel", gfc_match_omp_eos_error,
> + matcho ("end target parallel loop", gfc_match_omp_end_nowait,
> + ST_OMP_END_TARGET_PARALLEL_LOOP);
Similarly.
> + matcho ("end target parallel", gfc_match_omp_end_nowait,
> ST_OMP_END_TARGET_PARALLEL);
Similarly.
> - matchs ("end target simd", gfc_match_omp_eos_error,
> ST_OMP_END_TARGET_SIMD);
> + matchs ("end target simd", gfc_match_omp_end_nowait,
> ST_OMP_END_TARGET_SIMD);
Similarly.
> matchs ("end target teams distribute parallel do simd",
> - gfc_match_omp_eos_error,
> + gfc_match_omp_end_nowait,
> ST_OMP_END_TARGET_TEAMS_DISTRIBUTE_PARALLEL_DO_SIMD);
> - matcho ("end target teams distribute parallel do",
> gfc_match_omp_eos_error,
> + matcho ("end target teams distribute parallel do",
> + gfc_match_omp_end_nowait,
> ST_OMP_END_TARGET_TEAMS_DISTRIBUTE_PARALLEL_DO);
> - matchs ("end target teams distribute simd", gfc_match_omp_eos_error,
> + matchs ("end target teams distribute simd", gfc_match_omp_end_nowait,
> ST_OMP_END_TARGET_TEAMS_DISTRIBUTE_SIMD);
> - matcho ("end target teams distribute", gfc_match_omp_eos_error,
> + matcho ("end target teams distribute", gfc_match_omp_end_nowait,
> ST_OMP_END_TARGET_TEAMS_DISTRIBUTE);
> - matcho ("end target teams", gfc_match_omp_eos_error,
> ST_OMP_END_TARGET_TEAMS);
> - matcho ("end target", gfc_match_omp_eos_error, ST_OMP_END_TARGET);
> + matcho ("end target teams loop", gfc_match_omp_end_nowait,
> + ST_OMP_END_TARGET_TEAMS_LOOP);
> + matcho ("end target teams", gfc_match_omp_end_nowait,
> + ST_OMP_END_TARGET_TEAMS);
> + matcho ("end target", gfc_match_omp_end_nowait, ST_OMP_END_TARGET);
Similarly all the above. !$omp end target
followed by anything should accept nowait.
> matcho ("end taskgroup", gfc_match_omp_eos_error,
> ST_OMP_END_TASKGROUP);
> matchs ("end taskloop simd", gfc_match_omp_eos_error,
> ST_OMP_END_TASKLOOP_SIMD);
> matcho ("end taskloop", gfc_match_omp_eos_error, ST_OMP_END_TASKLOOP);
> matcho ("end task", gfc_match_omp_eos_error, ST_OMP_END_TASK);
> - matchs ("end teams distribute parallel do simd",
> gfc_match_omp_eos_error,
> + matchs ("end teams distribute parallel do simd",
> gfc_match_omp_end_nowait,
> ST_OMP_END_TEAMS_DISTRIBUTE_PARALLEL_DO_SIMD);
> - matcho ("end teams distribute parallel do", gfc_match_omp_eos_error,
> + matcho ("end teams distribute parallel do", gfc_match_omp_end_nowait,
These again shouldn't allow nowait, the outermost leaf construct
that accepts nowait is do and when do is combined with parallel, nowait
shouldn't be specified.
Jakub