Skip to content

[flang] [OpenMP] crash with Assertion `AggOutputArgBegin != newFunction->arg_end() && "Number of aggregate output arguments should match " "the number of defined values"' failed. #70579

Closed
@k-arrows

Description

@k-arrows

Here is the reproducer, which is reduced and modified from the subroutine dep3 in https://github.com/gcc-mirror/gcc/blob/master/libgomp/testsuite/libgomp.fortran/depend-1.f90.

$ cat test.f90
subroutine test
    integer :: x

    !$omp parallel private(x)

        !$omp task shared (x) depend(in: x)
        !$omp end task

    !$omp end parallel
end subroutine test

Assertion:

flang-new: /tmp/llvm-project/llvm/lib/Transforms/Utils/CodeExtractor.cpp:1363: llvm::CallInst *llvm::CodeExtractor::emitCallAndSwitchStatement(llvm::Function *, llvm::BasicBlock *, llvm::CodeExtractor::ValueSet &, llvm::CodeExtractor::ValueSet &): Assertion `AggOutputArgBegin != newFunction->arg_end() && "Number of aggregate output arguments should match " "the number of defined values"' failed.

Stack dump:

 #0 0x00005646dffb9359 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) 
 #1 0x00005646dffb99d4 SignalHandler(int) Signals.cpp:0:0
 #2 0x00007f19267de520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #3 0x00007f1926832a7c __pthread_kill_implementation ./nptl/pthread_kill.c:44:76
 #4 0x00007f1926832a7c __pthread_kill_internal ./nptl/pthread_kill.c:78:10
 #5 0x00007f1926832a7c pthread_kill ./nptl/pthread_kill.c:89:10
 #6 0x00007f19267de476 gsignal ./signal/../sysdeps/posix/raise.c:27:6
 #7 0x00007f19267c47f3 abort ./stdlib/abort.c:81:7
 #8 0x00007f19267c471b _nl_load_domain ./intl/loadmsgcat.c:1177:9
 #9 0x00007f19267d5e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
#10 0x00005646e247539e std::map<llvm::BasicBlock*, llvm::BasicBlock*, std::less<llvm::BasicBlock*>, std::allocator<std::pair<llvm::BasicBlock* const, llvm::BasicBlock*>>>::operator[](llvm::BasicBlock* const&) 
#11 0x00005646e24763d7 llvm::CodeExtractor::extractCodeRegion(llvm::CodeExtractorAnalysisCache const&, llvm::SetVector<llvm::Value*, llvm::SmallVector<llvm::Value*, 0u>, llvm::DenseSet<llvm::Value*, llvm::DenseMapInfo<llvm::Value*, void>>, 0u>&, llvm::SetVector<llvm::Value*, llvm::SmallVector<llvm::Value*, 0u>, llvm::DenseSet<llvm::Value*, llvm::DenseMapInfo<llvm::Value*, void>>, 0u>&) 
#12 0x00005646e24758a8 llvm::CodeExtractor::extractCodeRegion(llvm::CodeExtractorAnalysisCache const&) 
#13 0x00005646e21a5d82 llvm::OpenMPIRBuilder::finalize(llvm::Function*) 
#14 0x00005646e1574281 mlir::LLVM::ModuleTranslation::~ModuleTranslation() 
#15 0x00005646e1578ef4 mlir::translateModuleToLLVMIR(mlir::Operation*, llvm::LLVMContext&, llvm::StringRef) 
#16 0x00005646e03ce624 Fortran::frontend::CodeGenAction::generateLLVMIR() 
#17 0x00005646e03d01ee Fortran::frontend::CodeGenAction::executeAction() 
#18 0x00005646dffd9d2c Fortran::frontend::FrontendAction::execute() 
#19 0x00005646dffd0bc3 Fortran::frontend::CompilerInstance::executeAction(Fortran::frontend::FrontendAction&) 
#20 0x00005646dffdcb7e Fortran::frontend::executeCompilerInvocation(Fortran::frontend::CompilerInstance*) 
#21 0x00005646dfca113d fc1_main(llvm::ArrayRef<char const*>, char const*) 
#22 0x00005646dfca0126 main 
#23 0x00007f19267c5d90 __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:58:16
#24 0x00007f19267c5e40 call_init ./csu/../csu/libc-start.c:128:20
#25 0x00007f19267c5e40 __libc_start_main ./csu/../csu/libc-start.c:379:5
#26 0x00005646dfc9f685 _start 
flang-new: error: unable to execute command: Aborted
flang-new: error: flang frontend command failed due to signal (use -v to see invocation)
flang-new version 18.0.0 (https://github.com/llvm/llvm-project.git a8e0acf660639078a7e5341dd6ec82326d3b796b)
Target: x86_64-unknown-linux-gnu
Thread model: posix

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