Skip to content

[flang] compiler crashes in OptimizedBufferizationPass when dot_product is used inside parallel region #116954

Closed
@shivaramaarao

Description

@shivaramaarao

The issue is observed when compiling cp2k.

A reproducer is here:
 SUBROUTINE mysub()
      INTEGER  :: ns,  ne
      REAL(KIND=8), ALLOCATABLE, DIMENSION(:, :, :)     :: ar1, ar2
      REAL(KIND=8), DIMENSION(20)          :: d

!$OMP PARALLEL PRIVATE(n,ns,ne,ar1,ar2)
         d(ns:ne) = &
            (/(DOT_PRODUCT(ar1(:, n, n), ar2(:, n, n)),n=ns, ne)/)
!$OMP END PARALLEL
   END SUBROUTINE

Invocation and crash message:

$flang -O1 -fopenmp tm1.f90
flang-20: warning: OpenMP support in flang is still experimental [-Wexperimental-option]
flang: /home/shivaram/llvm_trunk/llvm-project/llvm/include/llvm/ADT/STLExtras.h:1289: ReferenceT llvm::detail::indexed_accessor_range_base<DerivedT, BaseT, T, PointerT, ReferenceT>::operator[](size_t) const [with DerivedT = mlir::OperandRange; BaseT = mlir::OpOperand*; T = mlir::Value; PointerT = mlir::Value; ReferenceT = mlir::Value; size_t = long unsigned int]: Assertion `Index < size() && "invalid index for value range"' failed.

at -O0 the testcase compiles. at O1 and above, the crash is observed.

Metadata

Metadata

Labels

crashPrefer [crash-on-valid] or [crash-on-invalid]flang:ir

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions