diff options
| author | Krzysztof Parzyszek <Krzysztof.Parzyszek@amd.com> | 2025-11-22 12:28:58 -0600 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-11-22 12:28:58 -0600 |
| commit | c2d659b9b8efac9f80b8ebcb2b38b61295d82bdc (patch) | |
| tree | 5b03136dfe47e5301733fd117ac5d71b3ab94fcb /flang/test/Semantics/OpenMP/loop-association.f90 | |
| parent | 216e85bdda22ae7eda3f3e04c51d9d6d82e2b617 (diff) | |
[flang][OpenMP] Implement loop nest parser (#168884)
Previously, loop constructs were parsed in a piece-wise manner: the
begin directive, the body, and the end directive were parsed separately.
Later on in canonicalization they were all coalesced into a loop
construct. To facilitate that end-loop directives were given a special
treatment, namely they were parsed as OpenMP constructs. As a result
syntax errors caused by misplaced end-loop directives were handled
differently from those cause by misplaced non-loop end directives.
The new loop nest parser constructs the complete loop construct,
removing the need for the canonicalization step. Additionally, it is the
basis for parsing loop-sequence-associated constructs in the future.
It also removes the need for the special treatment of end-loop
directives. While this patch temporarily degrades the error messaging
for misplaced end-loop directives, it enables uniform handling of any
misplaced end-directives in the future.
Diffstat (limited to 'flang/test/Semantics/OpenMP/loop-association.f90')
| -rw-r--r-- | flang/test/Semantics/OpenMP/loop-association.f90 | 36 |
1 files changed, 15 insertions, 21 deletions
diff --git a/flang/test/Semantics/OpenMP/loop-association.f90 b/flang/test/Semantics/OpenMP/loop-association.f90 index 9fac508e6128..b2898d3967a2 100644 --- a/flang/test/Semantics/OpenMP/loop-association.f90 +++ b/flang/test/Semantics/OpenMP/loop-association.f90 @@ -17,11 +17,13 @@ !$omp end parallel !$omp parallel do + !ERROR: DO CONCURRENT loops cannot form part of a loop nest. DO CONCURRENT (i = 1:N) a = 3.14 END DO !$omp parallel do simd + !ERROR: The associated loop of a loop-associated directive cannot be a DO WHILE. outer: DO WHILE (c > 1) inner: do while (b > 100) a = 3.14 @@ -31,7 +33,10 @@ END DO outer ! Accept directives between parallel do and actual loop. + !ERROR: A DO loop must follow the PARALLEL DO directive !$OMP PARALLEL DO + !WARNING: Unrecognized compiler directive was ignored [-Wignored-directive] + !ERROR: Compiler directives are not allowed inside OpenMP loop constructs !DIR$ VECTOR ALIGNED DO 20 i=1,N a = a + 0.5 @@ -39,11 +44,14 @@ !$OMP END PARALLEL DO c = 16 - !ERROR: DO loop after the PARALLEL DO directive must have loop control !$omp parallel do + !ERROR: Loop control is not present in the DO LOOP + !ERROR: The associated loop of a loop-associated directive cannot be a DO without control. do a = 3.14 c = c - 1 + !ERROR: EXIT to construct outside of PARALLEL DO construct is not allowed + !ERROR: EXIT statement terminates associated loop of an OpenMP DO construct if (c < 1) exit enddo @@ -57,9 +65,9 @@ do 100 j=1, N a = 3.14 100 continue - !ERROR: The ENDDO directive must follow the DO loop associated with the loop construct !$omp enddo + !ERROR: Non-THREADPRIVATE object 'a' in COPYIN clause !$omp parallel do copyin(a) do i = 1, N !$omp parallel do @@ -74,8 +82,6 @@ do i = 1, N enddo !$omp end parallel do - !ERROR: The END PARALLEL DO directive must follow the DO loop associated with the loop construct - !$omp end parallel do !$omp parallel a = 3.0 @@ -84,27 +90,22 @@ enddo !$omp end do simd + !ERROR: Non-THREADPRIVATE object 'a' in COPYIN clause !$omp parallel do copyin(a) do i = 1, N enddo !$omp end parallel a = 0.0 - !ERROR: The END PARALLEL DO directive must follow the DO loop associated with the loop construct - !$omp end parallel do !$omp parallel do private(c) do i = 1, N do j = 1, N - !ERROR: A DO loop must follow the PARALLEL DO directive + !ERROR: OpenMP loop construct should contain a DO-loop or a loop-nest-generating OpenMP construct !$omp parallel do shared(b) a = 3.14 enddo - !ERROR: The END PARALLEL DO directive must follow the DO loop associated with the loop construct - !$omp end parallel do enddo a = 1.414 - !ERROR: The END PARALLEL DO directive must follow the DO loop associated with the loop construct - !$omp end parallel do do i = 1, N !$omp parallel do @@ -112,29 +113,22 @@ a = 3.14 enddo enddo - !ERROR: The END PARALLEL DO directive must follow the DO loop associated with the loop construct - !$omp end parallel do - !ERROR: A DO loop must follow the PARALLEL DO directive + !ERROR: OpenMP loop construct should contain a DO-loop or a loop-nest-generating OpenMP construct !$omp parallel do private(c) 5 FORMAT (1PE12.4, I10) do i=1, N a = 3.14 enddo - !ERROR: The END PARALLEL DO directive must follow the DO loop associated with the loop construct - !$omp end parallel do !$omp parallel do simd do i = 1, N a = 3.14 enddo !$omp end parallel do simd - !ERROR: The END PARALLEL DO SIMD directive must follow the DO loop associated with the loop construct - !$omp end parallel do simd - !ERROR: A DO loop must follow the SIMD directive + !ERROR: OpenMP loop construct should contain a DO-loop or a loop-nest-generating OpenMP construct !$omp simd - a = i + 1 - !ERROR: The END SIMD directive must follow the DO loop associated with the loop construct !$omp end simd + a = i + 1 end |
