[flang-commits] [flang] [flang][OpenMP] Support reduction of allocatable variables (PR #88392)

Ye Luo via flang-commits flang-commits at lists.llvm.org
Tue Apr 16 10:09:16 PDT 2024


ye-luo wrote:

```
program main
  implicit none

  integer:: i
  REAL(8) :: EtsvdW_period
  REAL(8), DIMENSION(:,:), ALLOCATABLE :: FtsvdW_period,HtsvdW_period
  ALLOCATE(HtsvdW_period(3,3))

  !$omp parallel do reduction(+:EtsvdW_period) reduction(+:HtsvdW_period)
  do i=1,10
  enddo

endprogram
```
got ICE with `flang-new -fopenmp main.f90`
```
$ flang-new -fopenmp main.f90
flang-new: /home/yeluo/opt/llvm-clang/llvm-project/llvm/lib/IR/Instructions.cpp:3292: static BinaryOperator *llvm::BinaryOperator::Create(BinaryOps, Value *, Value *, const Twine &, Instruction *): Assertion `S1->getType() == S2->getType() && "Cannot create binary operator with two operands of differing type!"' failed.
```
If I fuse two reductions.
```
!$omp parallel do reduction(+:EtsvdW_period,HtsvdW_period)
```
the code compiles.


https://github.com/llvm/llvm-project/pull/88392


More information about the flang-commits mailing list