Skip to content

[flang][OpenMP] Crash with DO CONCURRENT lowering #149563

@eugeneepshteyn

Description

@eugeneepshteyn

(This started happening recently, I will try to at least identify the commit range soon.)

Consider the following test:

subroutine test(a)
  character(*) :: a(:)
  logical :: success 
  success = .true.
  do concurrent (i=1:Size(a)) local_init(success)
    a(i) = 'loop'
    if (.not. success) then
      error stop "fail"
    endif
  enddo
end

Compiling with flang -c test.f90 results in the following functions in the backtrace:

...
 #5 0x00005cea3a2be38c mlir::Operation::getBlock() llvm-project/flang/../mlir/include/mlir/IR/Operation.h:213:30
 #6 0x00005cea3a2fe631 mlir::OpBuilder::setInsertionPoint(mlir::Operation*) llvm-project/flang/../mlir/include/mlir/IR/Builders.h:405:27
 #7 0x00005cea3b7db736 void Fortran::lower::omp::ReductionProcessor::processReductionArguments<fir::DeclareReductionOp, llvm::SmallVector<fir::ReduceOperationEnum, 12u>>(mlir::Location, Fortran::lower::AbstractConverter&, llvm::SmallVector<fir::ReduceOperationEnum, 12u> const&, llvm::SmallVectorImpl<mlir::Value>&, llvm::SmallVectorImpl<bool>&, llvm::SmallVectorImpl<mlir::Attribute>&, llvm::SmallVectorImpl<Fortran::semantics::Symbol const*> const&) llvm-project/flang/lib/Lower/Support/ReductionProcessor.cpp:650:42
 #8 0x00005cea3a286aad (anonymous namespace)::FirConverter::handleLocalitySpecs((anonymous namespace)::IncrementLoopInfo const&) llvm-project/flang/lib/Lower/Bridge.cpp:2130:24
 #9 0x00005cea3a282f13 (anonymous namespace)::FirConverter::genFIRIncrementLoopBegin(llvm::SmallVector<(anonymous namespace)::IncrementLoopInfo, 8u>&, llvm::SmallVectorImpl<Fortran::parser::CompilerDirective const*>&) llvm-project/flang/lib/Lower/Bridge.cpp:2541:9
#10 0x00005cea3a2812fb (anonymous namespace)::FirConverter::genFIR(Fortran::parser::DoConstruct const&) llvm-project/flang/lib/Lower/Bridge.cpp:2257:17
#11 0x00005cea3a280cb0 auto (anonymous namespace)::FirConverter::genFIR(Fortran::lower::pft::Evaluation&, bool)::'lambda'(auto const&)::operator()<Fortran::parser::DoConstruct>(auto const&) const llvm-project/flang/lib/Lower/Bridge.cpp:5635:54
...

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions