[flang-commits] [flang] [flang][OpenMP] Catch threadprivate common block vars that appear in equivalence (PR #127642)

Kelvin Li via flang-commits flang-commits at lists.llvm.org
Fri Feb 21 11:36:33 PST 2025


kkwli wrote:

> I think @luporl is basing the change of this PR on the following points from the standard.
> 
> ```
> Page 61 : OpenMP 5.2
> 
> 11 When a named common block appears in an OpenMP argument list, it has the same meaning and
> 12 restrictions as if every explicit member of the common block appeared in the list. An explicit
> 13 member of a common block is a variable that is named in a COMMON statement that specifies the
> 14 common block name and is declared in the same scoping unit in which the clause appears.
> 
> Page 105 : OpenMP 5.2
> 
> 8 A variable may only appear as an argument in a threadprivate directive in the scope in
> 9 which it is declared. It must not be an element of a common block or appear in an
> 10 EQUIVALENCE statement.
> ```
> 
> I see that gfortran also adopts this interpretation. But ifx and classic flang/nvfortran do not and allow the usage in https://github.com/fujitsu/compiler-test-suite/blob/main/Fortran/0685/0685_0007.f90 @kkwli @mjklemm Any opinion here?

@kiranchandramohan I agree. The idea is that `threadprivate(/com1/)` is the same as `threadprivate(ia,ib)`. If `iz` is referenced in the parallel region, there is no way to tell which copy of the `ia` is actually referenced. The code in `0685_0007.f90` is nonconforming. In my opinion, it would be better to issue an error.

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


More information about the flang-commits mailing list