[flang-commits] [flang] [Flang][OpenMP] Parse and semantically analyze common blocks in map clauses correctly (PR #89847)

via flang-commits flang-commits at lists.llvm.org
Fri Apr 26 10:23:04 PDT 2024


================
@@ -2,16 +2,20 @@
 ! Check OpenMP MAP clause validity. Section 5.8.3 OpenMP 5.2.
 
 subroutine sb(arr)
+  implicit none
   real(8) :: arr(*)
   real :: a
-
+  integer:: b, c, i
+  common /var/ b, c  
+  
   !ERROR: Assumed-size whole arrays may not appear on the MAP clause
   !$omp target map(arr)
   do i = 1, 100
      a = 3.14
   enddo
   !$omp end target
 
+  !ERROR: Assumed-size array 'arr' must have explicit final subscript upper bound value
----------------
agozillon wrote:

> F2023 C930: "The second subscript shall not be omitted from a _subscript-triplet_ in the last dimension of an assumed-size array."

Would it fall into any other ruling (my appologies I don't have access to a Fortran specification document in this case) as this seems to also be emitted elsewhere for regular Fortran e.g.:

```
subroutine s6(x)
  integer :: x(*)
!ERROR: Assumed-size array 'x' must have explicit final subscript upper bound value
  x(:) = [1, 2, 3]
end
```

And if not, does the OpenMP ruling apply in this case (e.g. "The upper bound for the last dimension of an assumed-size dummy array must be specified")? 

Or is this syntax perfectly legal and should be supported by the compiler (even if other compilers seem to error out on it, although, considering they also seem to not be too friendly to the common block syntax, that might not be the best way to judge things)?  

https://github.com/llvm/llvm-project/pull/89847


More information about the flang-commits mailing list