Skip to content

[flang][OpenMP] Compilation error of the same COMMON block specified in two THREADPRIVATE directive clauses #61200

@ohno-fj

Description

@ohno-fj
Version of flang-new : 17.0.0(0303eafcb34647f7d5a4015aad266b5766f5dc5e)

The same COMMON block specified in two THREADPRIVATE directives is a compile-time error.

The following are the test program, flang-new, GFortran and ifort compilation result.

omp30_example_a_25_04_.f90:

program main
  call A25_4_GOOD()
  print *,'pass'
end program main

SUBROUTINE A25_4_GOOD()
  COMMON /T/ A
!$OMP THREADPRIVATE(/T/)
  integer :: A
  A=100
  call A25_4S_GOOD()
  if (A.ne.101) print *,'err'
CONTAINS
  SUBROUTINE A25_4S_GOOD()
    COMMON /T/ A
!$OMP THREADPRIVATE(/T/)
    integer :: A
!$OMP PARALLEL COPYIN(/T/)
    A=A+1
!$OMP END PARALLEL
  END SUBROUTINE A25_4S_GOOD
END SUBROUTINE A25_4_GOOD
$ flang-new -flang-experimental-exec -fopenmp omp30_example_a_25_04_.f90
error: Semantic errors in omp30_example_a_25_04_.f90
./omp30_example_a_25_04_.f90:16:22: error: 't' appears in more than one data-sharing clause on the same OpenMP directive
  !$OMP THREADPRIVATE(/T/)
                       ^
./omp30_example_a_25_04_.f90:18:24: error: Non-THREADPRIVATE object 'a' in COPYIN clause
  !$OMP PARALLEL COPYIN(/T/)
                         ^
$
$ gfortran -fopenmp omp30_example_a_25_04_.f90
$
$ ifort -qopenmp omp30_example_a_25_04_.f90
$

Metadata

Metadata

Assignees

Labels

bugIndicates an unexpected problem or unintended behaviorflang:frontendopenmp

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions