Skip to content

[flang][OpenMP] Invalid restriction for linear(ref(x)) #144563

Open
@eugeneepshteyn

Description

@eugeneepshteyn

Test file:

subroutine test(omega0, g, tau)
!$omp declare simd(test) notinbranch linear(ref(omega0)) linear(ref(tau)) linear(ref(g))
    real, intent(inout) :: omega0
    real, intent(inout) :: g
    real, intent(inout) :: tau
    
end subroutine test

Compile:

$ flang -c -fopenmp omp-linear-ref.f90 
flang-21: warning: OpenMP support in flang is still experimental [-Wexperimental-option]
error: Semantic errors in omp-linear-ref.f90
./omp-linear-ref.f90:2:49: error: The list item `omega0` specified with the REF 'linear-modifier' must be polymorphic variable, assumed-shape array, or a variable with the `ALLOCATABLE` attribute
  !$omp declare simd(test) notinbranch linear(ref(omega0)) linear(ref(tau)) linear(ref(g))
                                                  ^^^^^^
./omp-linear-ref.f90:2:69: error: The list item `tau` specified with the REF 'linear-modifier' must be polymorphic variable, assumed-shape array, or a variable with the `ALLOCATABLE` attribute
  !$omp declare simd(test) notinbranch linear(ref(omega0)) linear(ref(tau)) linear(ref(g))
                                                                      ^^^
./omp-linear-ref.f90:2:86: error: The list item `g` specified with the REF 'linear-modifier' must be polymorphic variable, assumed-shape array, or a variable with the `ALLOCATABLE` attribute
  !$omp declare simd(test) notinbranch linear(ref(omega0)) linear(ref(tau)) linear(ref(g))
                                                                                       ^

I checked OpenMP 5.2 and 6.0 specs, and I don't see that "REF 'linear-modifier' must be polymorphic variable, assumed-shape array, or a variable with the ALLOCATABLE attribute". I see that ref must be a dummy argument and must not have value attribute.

ref seems to be deprecated and checking with a recent ifx compiler result in This form of the OpenMP* LINEAR clause is deprecated. warning, but not an error.

Compiler version:

$ flang --version
flang version 21.0.0git (https://github.com/eugeneepshteyn/llvm-project.git 71f72f4d5d1b820a3e6147289547821332eaf115)
Target: x86_64-unknown-linux-gnu
Thread model: posix
...
Build config: +unoptimized, +assertions

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions