[Patch] Fortran/openmp: Fix '!$omp end'

Jakub Jelinek jakub@redhat.com
Fri Nov 12 12:02:34 GMT 2021


On Fri, Nov 12, 2021 at 12:01:27PM +0100, Tobias Burnus wrote:
> With the attached patch, the following combined/composite
> directives accept 'nowait' at 'end':

I've filed https://github.com/OpenMP/spec/issues/3184 because
I think OpenMP 5.2 got it wrong (and 5.1 got it wrong for
the end directives in many other cases too).

I believe the general rule should be:
1) non-combined/composite constructs allow nowait when
   they mention the clause (critical, for/do, scope, sections, single,
   workshare)
2) for simd, do simd allow it
3) anything combined with target allows it

So:
> 
> "end critical"
> "end do simd"
> "end do"
> "end scope"
> "end sections"
> "end single"
> "end target parallel"               (newly permits nowait)
> "end target simd"                   (newly permits nowait)
> "end target teams distribute simd"  (newly permits nowait)
> "end target teams distribute"       (newly permits nowait)
> "end target teams loop"             (newly permits nowait)
> "end target teams"                  (newly permits nowait)
> "end target"
> "end workshare"

is ok, but:

> and the following don't
> 
> "end target parallel do simd"
> "end target parallel do"
> "end target parallel loop"  (was completely missing before)
> "end target teams distribute parallel do simd"
> "end target teams distribute parallel do"

The above 5 should allow it too.
As per e.g. 5.2 [341:23],
"The effect of the nowait clause is as if it is applied to the
outermost leaf construct that permits it."
so even for the above 5 the clause splitting should put
nowait on target and not the others and be done with it.

	Jakub



More information about the Gcc-patches mailing list