llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
28.58k stars 11.81k forks source link

[flang] [OpenMP] Assertion `redType.isIntOrIndexOrFloat() && "Unsupported reduction type"' failed #62826

Closed k-arrows closed 1 month ago

k-arrows commented 1 year ago

An assertion failure is hit. I will provide the source-level reproducer and the version information.

Assertion

OpenMP.cpp:1664: void genOMP(Fortran::lower::AbstractConverter &, Fortran::lower::pft::Evaluation &, const Fortran::parser::OpenMPLoopConstruct &): Assertion `redType.isIntOrIndexOrFloat() && "Unsupported reduction type"' failed.

Reproducer

$ cat test.f90
program test
   integer :: i
   integer, dimension(1:5) :: a, b
   a = 1
   print *, a
!$omp parallel
!$omp do reduction(max: a) private (b)
   do i = 1, 5
     b = (/ i, i + 1, i + 2 , i + 3 , i + 4 /)
     a = max(a, b)
   end do
!$omp end do
!$omp end parallel
   print *, a
end program

Version

$ flang-new --version
flang-new version 17.0.0 (https://github.com/llvm/llvm-project.git e335e8a43287b8258c719d7a21c4264b0550c554)
Target: x86_64-unknown-linux-gnu
Thread model: posix

With the old flang-new (llvm-16.0.4), the following TODO message is output.

OpenMP.cpp:1180: not yet implemented: Reduction of intrinsic procedures is not supported
llvmbot commented 1 year ago

@llvm/issue-subscribers-openmp

llvmbot commented 1 year ago

@llvm/issue-subscribers-flang-ir

llvmbot commented 1 year ago

@llvm/issue-subscribers-bug

tblah commented 1 month ago

This is now fixed with current flang main