Skip to content

[Flang][OpenMP] Assertion `!mold.isAssumedRank() && "cannot create temporary from assumed-rank mold"' failed. #152312

@k-arrows

Description

@k-arrows

Reproducer:

subroutine s(a)
integer :: a(..)
!$omp parallel reduction(+:a)
!$omp end parallel
end

With assertion-enabled flang, compiling the above reproducer results in the following assertion failure:

flang: /path_to_project/llvm-project/flang/lib/Optimizer/Builder/HLFIRTools.cpp:1352: std::pair<hlfir::Entity, mlir::Value> hlfir::createTempFromMold(mlir::Location, fir::FirOpBuilder &, hlfir::Entity): Assertion `!mold.isAssumedRank() && "cannot create temporary from assumed-rank mold"' failed.

Backtrace:

 #0 0x0000729477db3097 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int)
 #1 0x0000729477db0795 llvm::sys::RunSignalHandlers()
 #2 0x0000729477db3e45 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
 #3 0x0000729477442520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #4 0x00007294774969fc __pthread_kill_implementation ./nptl/pthread_kill.c:44:76
 #5 0x00007294774969fc __pthread_kill_internal ./nptl/pthread_kill.c:78:10
 #6 0x00007294774969fc pthread_kill ./nptl/pthread_kill.c:89:10
 #7 0x0000729477442476 gsignal ./signal/../sysdeps/posix/raise.c:27:6
 #8 0x00007294774287f3 abort ./stdlib/abort.c:81:7
 #9 0x000072947742871b _nl_load_domain ./intl/loadmsgcat.c:1177:9
#10 0x0000729477439e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
#11 0x0000729472a933f1 
#12 0x0000729473e218c3 Fortran::lower::populateByRefInitAndCleanupRegions(Fortran::lower::AbstractConverter&, mlir::Location, mlir::Type, mlir::Value, mlir::Block*, mlir::Value, mlir::Value, mlir::Region&, Fortran::lower::DeclOperationKind, Fortran::semantics::Symbol const*, bool, bool)
#13 0x0000729473e25db4 mlir::omp::DeclareReductionOp Fortran::lower::omp::ReductionProcessor::createDeclareReduction<mlir::omp::DeclareReductionOp>(Fortran::lower::AbstractConverter&, llvm::StringRef, Fortran::lower::omp::ReductionProcessor::ReductionIdentifier, mlir::Type, mlir::Location, bool)
#14 0x0000729473e25411 bool Fortran::lower::omp::ReductionProcessor::processReductionArguments<mlir::omp::DeclareReductionOp, llvm::SmallVector<tomp::type::ReductionIdentifierT<Fortran::lower::omp::IdTyTemplate<Fortran::evaluate::Expr<Fortran::evaluate::SomeType>>, Fortran::evaluate::Expr<Fortran::evaluate::SomeType>>, 0u>>(mlir::Location, Fortran::lower::AbstractConverter&, llvm::SmallVector<tomp::type::ReductionIdentifierT<Fortran::lower::omp::IdTyTemplate<Fortran::evaluate::Expr<Fortran::evaluate::SomeType>>, Fortran::evaluate::Expr<Fortran::evaluate::SomeType>>, 0u> const&, llvm::SmallVectorImpl<mlir::Value>&, llvm::SmallVectorImpl<bool>&, llvm::SmallVectorImpl<mlir::Attribute>&, llvm::SmallVectorImpl<Fortran::semantics::Symbol const*> const&)
#15 0x0000729473d58b48 std::_Function_handler<void (tomp::clause::ReductionT<Fortran::evaluate::DynamicType, Fortran::lower::omp::IdTyTemplate<Fortran::evaluate::Expr<Fortran::evaluate::SomeType>>, Fortran::evaluate::Expr<Fortran::evaluate::SomeType>> const&, Fortran::parser::CharBlock const&), Fortran::lower::omp::ClauseProcessor::processReduction(mlir::Location, mlir::omp::ReductionClauseOps&, llvm::SmallVectorImpl<Fortran::semantics::Symbol const*>&) const::$_15>::_M_invoke(std::_Any_data const&, tomp::clause::ReductionT<Fortran::evaluate::DynamicType, Fortran::lower::omp::IdTyTemplate<Fortran::evaluate::Expr<Fortran::evaluate::SomeType>>, Fortran::evaluate::Expr<Fortran::evaluate::SomeType>> const&, Fortran::parser::CharBlock const&) ClauseProcessor.cpp:0:0
#16 0x0000729473d23715 Fortran::lower::omp::ClauseProcessor::processReduction(mlir::Location, mlir::omp::ReductionClauseOps&, llvm::SmallVectorImpl<Fortran::semantics::Symbol const*>&) const
#17 0x0000729473dbb298 genParallelClauses(Fortran::lower::AbstractConverter&, Fortran::semantics::SemanticsContext&, Fortran::lower::StatementContext&, llvm::SmallVector<Fortran::lower::omp::Clause, 0u> const&, mlir::Location, mlir::omp::detail::Clauses<mlir::omp::AllocateClauseOps, mlir::omp::IfClauseOps, mlir::omp::NumThreadsClauseOps, mlir::omp::PrivateClauseOps, mlir::omp::ProcBindClauseOps, mlir::omp::ReductionClauseOps>&, llvm::SmallVectorImpl<Fortran::semantics::Symbol const*>&) OpenMP.cpp:0:0
#18 0x0000729473db282b genOMPDispatch(Fortran::lower::AbstractConverter&, Fortran::lower::SymMap&, Fortran::semantics::SemanticsContext&, Fortran::lower::pft::Evaluation&, mlir::Location, llvm::SmallVector<tomp::DirectiveWithClauses<Fortran::lower::omp::Clause>, 0u> const&, tomp::DirectiveWithClauses<Fortran::lower::omp::Clause> const*) OpenMP.cpp:0:0
#19 0x0000729473dab749 Fortran::lower::genOpenMPConstruct(Fortran::lower::AbstractConverter&, Fortran::lower::SymMap&, Fortran::semantics::SemanticsContext&, Fortran::lower::pft::Evaluation&, Fortran::parser::OpenMPConstruct const&)

(trace continues...)

Metadata

Metadata

Assignees

Labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions