Skip to content

[Flang][OpenMP] Compilation error when derived type with procedure pointer appears within private attribute #109727

Closed
@ohno-fj

Description

@ohno-fj
Version of flang-new : 20.0.0(675c748bb606d75a959481e6014299849cf3094c)/AArch64

When building GAMESS, the following error is detected.
When derived type with procedure pointer appears within private attribute, a compilation-time error (Lowering to LLVM IR failed) occurs.

A similar error occurs with firstprivate attribute.
Compilation succeeds in the following case:

  • Do not specify -fopenmp option.

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

foo.F90:

module m1
  type :: typ1
     procedure(), pointer, nopass :: p1  => null()
  end type typ1
contains
  subroutine sub2()
    type(typ1) :: t1
!$omp parallel private(t1)
!$omp end parallel
  end subroutine sub2
end module m1

program main
  use m1
  print *,'pass'
end program main
$ flang-new -c -fopenmp foo.F90
error: loc("/work/home/ohno/CT/test/fort/tp/reproducerJ/Metro/GAMESS/foo.F90":7:19): Invalid yielded value. Expected type: '!fir.ref<!fir.type<_QMm1Ttyp1{p1:!fir.boxproc<() -> ()>}>>', got: '!fir.ref<!fir.type<_QMm1Ttyp1UnboxProc{p1:() -> ()}>>'
error: Lowering to LLVM IR failed
error: loc("/work/home/ohno/CT/test/fort/tp/reproducerJ/Metro/GAMESS/foo.F90":1:1): LLVM Translation failed for operation: fir.global
error: failed to create the LLVM module
$
$ flang-new -c foo.F90
$ ls -al *.o
-rw-rw-r--. 1 ohno ohno 7784 Sep 20 15:27 foo.o
$

Metadata

Metadata

Type

No type

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions