llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
29.14k stars 12.02k forks source link

[Flang][OpenMP] OpenMP directive DEFAULT (NONE) is set, but a compilation-time error occurs indicating that the variable does not specify data-sharing attribute. #110442

Closed ohno-fj closed 3 weeks ago

ohno-fj commented 1 month ago
Version of flang-new : 20.0.0(2603c8b23be06116bc61bda36fae05b81d906c3f)/AArch64

When building CP2K, the following error is detected.
OpenMP directive DEFAULT (NONE) is set, but a compilation-time error occurs indicating that the variable does not specify data-sharing attribute.

The following are a self-made reproducer, Flang-new compilation result.

z1.f90:

subroutine sub( aaa)
  real,dimension(*),intent(in)::aaa
  integer::ip
  real::ccc
!$omp parallel do private(ip,ccc) default(none)
  do ip = 1, 10
     ccc= aaa(ip)
  end do
end subroutine sub

program main
  real::arg(10)
  arg=1.0
  print *,'pass'
end program main
$ flang-new -fopenmp z1.f90
error: Semantic errors in z1.f90
./z1.f90:7:11: error: The DEFAULT(NONE) clause requires that 'aaa' must be listed in a data-sharing attribute clause
       ccc= aaa(ip)
            ^^^
$
llvmbot commented 1 month ago

@llvm/issue-subscribers-clang-frontend

Author: None (ohno-fj)

``` Version of flang-new : 20.0.0(2603c8b23be06116bc61bda36fae05b81d906c3f)/AArch64 ``` When building [CP2K](https://www.cp2k.org/), the following error is detected. `OpenMP` directive `DEFAULT (NONE)` is set, but a compilation-time error occurs indicating that the variable does not specify `data-sharing` attribute. The following are a self-made reproducer, Flang-new compilation result. z1.f90: ```fortran subroutine sub( aaa) real,dimension(*),intent(in)::aaa integer::ip real::ccc !$omp parallel do private(ip,ccc) default(none) do ip = 1, 10 ccc= aaa(ip) end do end subroutine sub program main real::arg(10) arg=1.0 print *,'pass' end program main ``` ``` $ flang-new -fopenmp z1.f90 error: Semantic errors in z1.f90 ./z1.f90:7:11: error: The DEFAULT(NONE) clause requires that 'aaa' must be listed in a data-sharing attribute clause ccc= aaa(ip) ^^^ $ ```
llvmbot commented 3 weeks ago

@llvm/issue-subscribers-flang-frontend

Author: None (ohno-fj)

``` Version of flang-new : 20.0.0(2603c8b23be06116bc61bda36fae05b81d906c3f)/AArch64 ``` When building [CP2K](https://www.cp2k.org/), the following error is detected. `OpenMP` directive `DEFAULT (NONE)` is set, but a compilation-time error occurs indicating that the variable does not specify `data-sharing` attribute. The following are a self-made reproducer, Flang-new compilation result. z1.f90: ```fortran subroutine sub( aaa) real,dimension(*),intent(in)::aaa integer::ip real::ccc !$omp parallel do private(ip,ccc) default(none) do ip = 1, 10 ccc= aaa(ip) end do end subroutine sub program main real::arg(10) arg=1.0 print *,'pass' end program main ``` ``` $ flang-new -fopenmp z1.f90 error: Semantic errors in z1.f90 ./z1.f90:7:11: error: The DEFAULT(NONE) clause requires that 'aaa' must be listed in a data-sharing attribute clause ccc= aaa(ip) ^^^ $ ```
kiranchandramohan commented 3 weeks ago

Thanks, @ohno-fj, for trying to compile CP2K. Are there more known issues?

ohno-fj commented 2 weeks ago

@kiranchandramohan, thank you for your comment. I don't have any other problems about CP2K.