kparzysz wrote:
> Is the point that unlike in Fortran 77 loops, there is no ambiguity in
> parsing OpenMP loop constructs and hence we can parse it all together?
I guess the point would be that we preserve the "ambiguity", just wrap it in an
OpenMP construct.
The unstructured loops are simply parsed as a sequence of statements. Then, a
canonicalization procedure rewrites it in a form of a DO-loop. This is the
standard procedure, unrelated to OpenMP. The loop nest parser here does the
same thing---in case of a label-DO it accumulates statements up to and
including the terminating one and wraps the block in an OpenMPLoopConstruct.
This follows the syntax of a "nonblock DO construct" in the Fortran 90 standard
(section 8.1.6.1.2) [1].
The canonicalization step is unaffected by this. If the code follows the F90
rules, this is guaranteed to produce the correct loop.
If the terminating statement cannot be found, the block will contain statements
collected so far (until the end of the enclosing construct, typically until the
end of the subprogram). The resulting errors will be the same with and without
the OpenMP construct. Example:
```
subroutine f
integer :: i, j
!$omp do
do 10 i = 1, 10
do 20 j = 1, 10
10 continue
end
```
With OpenMP: `flang -fc1 -fsyntax-only -fopenmp t.f90`
```
error: Semantic errors in t.f90
./t.f90:5:3: error: Label '20' cannot be found
do 20 j = 1, 10
^^^^^^^^^^^^^^^
```
Without OpenMP: `flang -fc1 -fsyntax-only t.f90`
```
error: Semantic errors in t.f90
./t.f90:5:3: error: Label '20' cannot be found
do 20 j = 1, 10
^^^^^^^^^^^^^^^
```
[1] AFAIK, it was the last standard that supported it before deprecation.
https://github.com/llvm/llvm-project/pull/168884
_______________________________________________
llvm-branch-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-branch-commits