Issue 109727
Summary [Flang][OpenMP] Compilation error when derived type with procedure pointer appears within private attribute
Labels flang:ir, flang:openmp
Assignees
Reporter ohno-fj
    ```
Version of flang-new : 20.0.0(675c748bb606d75a959481e6014299849cf3094c)/AArch64
```

When building [GAMESS](https://www.msg.chem.iastate.edu/gamess/index.html), 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:
```fortran
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
$
```

_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to