https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116705
Bug ID: 116705
Summary: Incorrect error in omp target teams distribute
parallel do
Product: gcc
Version: 14.2.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: chilikin.k at gmail dot com
Target Milestone: ---
With gfortran 14.2.0,
$ cat test.f90
SUBROUTINE S
USE, INTRINSIC :: ISO_C_BINDING
USE, INTRINSIC :: ISO_FORTRAN_ENV
IMPLICIT NONE
INTEGER, PARAMETER :: N = 1000000
REAL(REAL64), DIMENSION(N) :: A, B, C
TYPE(C_PTR) PTR
INTEGER I
!$OMP TARGET TEAMS DISTRIBUTE PARALLEL DO IS_DEVICE_PTR(PTR)
DO I = 1, N
A(I) = B(I) + C(I)
ENDDO
END SUBROUTINE
$ gfortran -c test.f90 -fopenmp
test.f90:9:58:
9 | !$OMP TARGET TEAMS DISTRIBUTE PARALLEL DO IS_DEVICE_PTR(PTR)
| 1
Error: List item 'ptr' in IS_DEVICE_PTR clause at (1) must be of TYPE(C_PTR)
The error is incorrect: the argument "PTR" is indeed of the type TYPE(C_PTR).
Similar example with just "omp target" works:
SUBROUTINE S
USE, INTRINSIC :: ISO_C_BINDING
USE, INTRINSIC :: ISO_FORTRAN_ENV
IMPLICIT NONE
INTEGER, PARAMETER :: N = 1000000
REAL(REAL64), DIMENSION(N) :: A, B, C
TYPE(C_PTR) PTR
INTEGER I
!$OMP TARGET IS_DEVICE_PTR(PTR)
DO I = 1, N
A(I) = B(I) + C(I)
ENDDO
!$OMP END TARGET
END SUBROUTINE