Issue 87607
Summary [Flang][OpenMP] crash at Fortran::lower::omp::ReductionProcessor::addDeclareReduction
Labels crash, flang, flang:openmp
Assignees
Reporter kiranktp
    Reproducer:
cat -n crash.f90
     1  Program P1
     2    Implicit None
     3 Contains
     4    Subroutine sub(a)
     5      Real,Intent(Out) :: a(:)
     6      Integer :: i
     7      !$Omp Parallel Do Reduction (+:a)
     8        Do i = 1, 10
     9        End Do
    10    End Subroutine sub
    11  End Program P1


Command: 
flang-new -fopenmp crash.f90

Stack dump:
flang-new: /home/llvm-project//llvm/include/llvm/Support/Casting.h:566: decltype(auto) llvm::cast(const From&) [with To = fir::ReferenceType; From = mlir::Type]: Assertion `is
a<To>(Val) && "cast<Ty>() argument of incompatible type!"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.      Program arguments: /home/llvm-project//install_rel/bin/flang-new -fc1 -triple x86_64-unknown-linux-gnu -emit-obj -fopenmp -fcolor-diagnostics -mrelocation-model pic -p
ic-level 2 -pic-is-pie -target-cpu x86-64 -mframe-pointer=all -o /tmp/crash-74c667.o -x f95-cpp-input crash.f90
 #0 0x00005e826730c8a0 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/llvm-project//install_rel/bin/flang-new+0x30c28a0)
 #1 0x00005e8267309caf llvm::sys::RunSignalHandlers() (/home/llvm-project//install_rel/bin/flang-new+0x30bfcaf)
 #2 0x00005e8267309e05 SignalHandler(int) Signals.cpp:0:0
 #3 0x000013cc49a42520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #4 0x000013cc49a969fc __pthread_kill_implementation ./nptl/pthread_kill.c:44:76
 #5 0x000013cc49a969fc __pthread_kill_internal ./nptl/pthread_kill.c:78:10
 #6 0x000013cc49a969fc pthread_kill ./nptl/pthread_kill.c:89:10
 #7 0x000013cc49a42476 gsignal ./signal/../sysdeps/posix/raise.c:27:6
 #8 0x000013cc49a287f3 abort ./stdlib/abort.c:81:7
 #9 0x000013cc49a2871b _nl_load_domain ./intl/loadmsgcat.c:1177:9
#10 0x000013cc49a39e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
#11 0x00005e826800c165 Fortran::lower::omp::ReductionProcessor::addDeclareReduction(mlir::Location, Fortran::lower::AbstractConverter&, tomp::clause::ReductionT<Fortran::evaluate::SomeType, Fortran::se
mantics::Symbol*, Fortran::evaluate::Expr<Fortran::evaluate::SomeType>> const&, llvm::SmallVectorImpl<mlir::Value>&, llvm::SmallVectorImpl<mlir::Attribute>&, llvm::SmallVectorImpl<Fortran::semantics::S
ymbol const*>*) (/home/llvm-project//install_rel/bin/flang-new+0x3dc2165)
#12 0x00005e8267ff5c0e std::_Function_handler<void (tomp::clause::ReductionT<Fortran::evaluate::SomeType, Fortran::semantics::Symbol*, Fortran::evaluate::Expr<Fortran::evaluate::SomeType>> const&, Fort
ran::parser::CharBlock const&), Fortran::lower::omp::ClauseProcessor::processReduction(mlir::Location, llvm::SmallVectorImpl<mlir::Value>&, llvm::SmallVectorImpl<mlir::Type>&, llvm::SmallVectorImpl<mli
r::Attribute>&, llvm::SmallVectorImpl<Fortran::semantics::Symbol const*>*) const::'lambda'(tomp::clause::ReductionT<Fortran::evaluate::SomeType, Fortran::semantics::Symbol*, Fortran::evaluate::Expr<For
tran::evaluate::SomeType>> const&, Fortran::parser::CharBlock const&)>::_M_invoke(std::_Any_data const&, tomp::clause::ReductionT<Fortran::evaluate::SomeType, Fortran::semantics::Symbol*, Fortran::eval
uate::Expr<Fortran::evaluate::SomeType>> const&, Fortran::parser::CharBlock const&) ClauseProcessor.cpp:0:0
#13 0x00005e8267ff8ee4 Fortran::lower::omp::ClauseProcessor::processReduction(mlir::Location, llvm::SmallVectorImpl<mlir::Value>&, llvm::SmallVectorImpl<mlir::Type>&, llvm::SmallVectorImpl<mlir::Attrib
ute>&, llvm::SmallVectorImpl<Fortran::semantics::Symbol const*>*) const (/home/llvm-project//install_rel/bin/flang-new+0x3daeee4)
#14 0x00005e8267f9c71c createWsloop(Fortran::lower::AbstractConverter&, Fortran::semantics::SemanticsContext&, Fortran::lower::pft::Evaluation&, llvm::omp::Directive, Fortran::parser::OmpClauseList con
st&, Fortran::parser::OmpClauseList const*, mlir::Location) OpenMP.cpp:0:0
#15 0x00005e8267fa6d31 genOMP(Fortran::lower::AbstractConverter&, Fortran::lower::SymMap&, Fortran::semantics::SemanticsContext&, Fortran::lower::pft::Evaluation&, Fortran::parser::OpenMPLoopConstruct
const&) OpenMP.cpp:0:0
#16 0x00005e8267f92378 Fortran::lower::genOpenMPConstruct(Fortran::lower::AbstractConverter&, Fortran::lower::SymMap&, Fortran::semantics::SemanticsContext&, Fortran::lower::pft::Evaluation&, Fortran::
parser::OpenMPConstruct const&) (/home/llvm-project//install_rel/bin/flang-new+0x3d48378)
#17 0x00005e8267b54adb std::__detail::__variant::__gen_vtable_impl<std::__detail::__variant::_Multi_array<std::__detail::__variant::__deduce_visit_result<void> (*)(Fortran::common::visitors<auto Fortra
n::lower::pft::ReferenceVariantBase<true, Fortran::parser::AllocateStmt, Fortran::parser
#18 0x00005e8267b9ca76 (anonymous namespace)::FirConverter::genFIR(Fortran::lower::pft::Evaluation&, bool) (.constprop.0) Bridge.cpp:0:0
#19 0x00005e8267bbf2bc (anonymous namespace)::FirConverter::lowerFunc(Fortran::lower::pft::FunctionLikeUnit&) Bridge.cpp:0:0
#20 0x00005e8267bc0051 (anonymous namespace)::FirConverter::lowerFunc(Fortran::lower::pft::FunctionLikeUnit&) Bridge.cpp:0:0
#21 0x00005e8267baf90d Fortran::lower::LoweringBridge::lower(Fortran::parser::Program const&, Fortran::semantics::SemanticsContext const&) (/home/llvm-project//install_rel/bin/flang-new+0x396590d)
#22 0x00005e826743598c Fortran::frontend::CodeGenAction::beginSourceFileAction() (/home/llvm-project//install_rel/bin/flang-new+0x31eb98c)
#23 0x00005e826734d1c5 Fortran::frontend::FrontendAction::beginSourceFile(Fortran::frontend::CompilerInstance&, Fortran::frontend::FrontendInputFile const&) (/home/llvm-project//install_rel/bin/flang-new+0x31031c5)
#24 0x00005e826732e38b Fortran::frontend::CompilerInstance::executeAction(Fortran::frontend::FrontendAction&) (/home/llvm-project//install_rel/bin/flang-new+0x30e438b)
#25 0x00005e82673513bb Fortran::frontend::executeCompilerInvocation(Fortran::frontend::CompilerInstance*) (/home/llvm-project//install_rel/bin/flang-new+0x31073bb)
#26 0x00005e8266e12ae8 fc1_main(llvm::ArrayRef<char const*>, char const*) (/home/llvm-project//install_rel/bin/flang-new+0x2bc8ae8)
#27 0x00005e8266e1236d main (/home/llvm-project//install_rel/bin/flang-new+0x2bc836d)
#28 0x000013cc49a29d90 __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16
#29 0x000013cc49a29e40 call_init ./csu/../csu/libc-start.c:128:20
#30 0x000013cc49a29e40 __libc_start_main ./csu/../csu/libc-start.c:379:5
#31 0x00005e8266e106e5 _start (/home/llvm-project//install_rel/bin/flang-new+0x2bc66e5)
flang-new: error: unable to execute command: Aborted (core dumped)
flang-new: error: flang frontend command failed due to signal (use -v to see invocation)
flang-new version 19.0.0git (https://github.com/llvm/llvm-project.git d89914f30bc7c180fe349a5aa0f03438ae6c20a4)

_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to