Skip to content

[Flang][OpenACC] crash on llvm-test-suite/Fortran/gfortran/regression/goacc/pr78260.f90 #169487

@k-arrows

Description

@k-arrows

Here is the reduced reproducer:
https://godbolt.org/z/f984oYsGs

Backtrace:

PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace and instructions to reproduce the bug.
Stack dump:
0.	Program arguments: /cefs/fb/fba5fba48770ecd1ded31708_clang-llvmflang-trunk-20251124/bin/flang -fc1 -triple x86_64-unknown-linux-gnu -S -fopenacc -mrelocation-model pic -pic-level 2 -pic-is-pie -target-cpu x86-64 -mllvm -x86-asm-syntax=intel -resource-dir /cefs/fb/fba5fba48770ecd1ded31708_clang-llvmflang-trunk-20251124/lib/clang/22 -mframe-pointer=all -o /app/output.s -x f95 /app/example.f90
 #0 0x000000000441b418 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/cefs/fb/fba5fba48770ecd1ded31708_clang-llvmflang-trunk-20251124/bin/flang+0x441b418)
 #1 0x00000000044185e4 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
 #2 0x0000741e58a42520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #3 0x0000000005053b43 Fortran::semantics::AccStructureChecker::CheckMultipleOccurrenceInDeclare(Fortran::parser::AccObjectList const&, llvm::acc::Clause)::'lambda'(Fortran::parser::Designator const&)::operator()(Fortran::parser::Designator const&) const (.isra.0) check-acc-structure.cpp:0:0
 #4 0x000000000505453d Fortran::semantics::AccStructureChecker::CheckMultipleOccurrenceInDeclare(Fortran::parser::AccObjectList const&, llvm::acc::Clause) (/cefs/fb/fba5fba48770ecd1ded31708_clang-llvmflang-trunk-20251124/bin/flang+0x505453d)
 #5 0x0000000004f78b77 std::enable_if<WrapperTrait<Fortran::parser::AccClauseList>, void>::type Fortran::parser::detail::ParseTreeVisitorLookupScope::Walk<Fortran::parser::AccClauseList, Fortran::semantics::SemanticsVisitor<Fortran::semantics::AccStructureChecker>>(Fortran::parser::AccClauseList const&, Fortran::semantics::SemanticsVisitor<Fortran::semantics::AccStructureChecker>&) (/cefs/fb/fba5fba48770ecd1ded31708_clang-llvmflang-trunk-20251124/bin/flang+0x4f78b77)
 #6 0x0000000004f78dab void Fortran::parser::detail::ParseTreeVisitorLookupScope::Walk<Fortran::parser::OpenACCDeclarativeConstruct, Fortran::semantics::SemanticsVisitor<Fortran::semantics::AccStructureChecker>>(std::__cxx11::list<Fortran::parser::OpenACCDeclarativeConstruct, std::allocator<Fortran::parser::OpenACCDeclarativeConstruct>> const&, Fortran::semantics::SemanticsVisitor<Fortran::semantics::AccStructureChecker>&) (/cefs/fb/fba5fba48770ecd1ded31708_clang-llvmflang-trunk-20251124/bin/flang+0x4f78dab)
 #7 0x0000000004fa20de std::enable_if<TupleTrait<Fortran::parser::SubroutineSubprogram>, void>::type Fortran::parser::detail::ParseTreeVisitorLookupScope::Walk<Fortran::parser::SubroutineSubprogram, Fortran::semantics::SemanticsVisitor<Fortran::semantics::AccStructureChecker>>(Fortran::parser::SubroutineSubprogram const&, Fortran::semantics::SemanticsVisitor<Fortran::semantics::AccStructureChecker>&) (/cefs/fb/fba5fba48770ecd1ded31708_clang-llvmflang-trunk-20251124/bin/flang+0x4fa20de)
 #8 0x0000000004fa23e4 void Fortran::parser::detail::ParseTreeVisitorLookupScope::ForEachInTuple<0ul, void Fortran::parser::detail::ParseTreeVisitorLookupScope::Walk<Fortran::semantics::SemanticsVisitor<Fortran::semantics::AccStructureChecker>, Fortran::parser::Statement<Fortran::parser::ContainsStmt>, std::__cxx11::list<Fortran::parser::ModuleSubprogram, std::allocator<Fortran::parser::ModuleSubprogram>>>(std::tuple<Fortran::parser::Statement<Fortran::parser::ContainsStmt>, std::__cxx11::list<Fortran::parser::ModuleSubprogram, std::allocator<Fortran::parser::ModuleSubprogram>>> const&, Fortran::semantics::SemanticsVisitor<Fortran::semantics::AccStructureChecker>&)::'lambda'(Fortran::semantics::SemanticsVisitor<Fortran::semantics::AccStructureChecker> const&), std::tuple<Fortran::parser::Statement<Fortran::parser::ContainsStmt>, std::__cxx11::list<Fortran::parser::ModuleSubprogram, std::allocator<Fortran::parser::ModuleSubprogram>>>>(std::tuple<Fortran::parser::Statement<Fortran::parser::ContainsStmt>, std::__cxx11::list<Fortran::parser::ModuleSubprogram, std::allocator<Fortran::parser::ModuleSubprogram>>> const&, void Fortran::parser::detail::ParseTreeVisitorLookupScope::Walk<Fortran::semantics::SemanticsVisitor<Fortran::semantics::AccStructureChecker>, Fortran::parser::Statement<Fortran::parser::ContainsStmt>, std::__cxx11::list<Fortran::parser::ModuleSubprogram, std::allocator<Fortran::parser::ModuleSubprogram>>>(std::tuple<Fortran::parser::Statement<Fortran::parser::ContainsStmt>, std::__cxx11::list<Fortran::parser::ModuleSubprogram, std::allocator<Fortran::parser::ModuleSubprogram>>> const&, Fortran::semantics::SemanticsVisitor<Fortran::semantics::AccStructureChecker>&)::'lambda'(Fortran::semantics::SemanticsVisitor<Fortran::semantics::AccStructureChecker> const&)) (/cefs/fb/fba5fba48770ecd1ded31708_clang-llvmflang-trunk-20251124/bin/flang+0x4fa23e4)
 #9 0x0000000004fa27d4 void Fortran::common::log2visit::Log2VisitHelper<0ul, 7ul, void, void Fortran::parser::detail::ParseTreeVisitorLookupScope::Walk<Fortran::semantics::SemanticsVisitor<Fortran::semantics::AccStructureChecker>, Fortran::common::Indirection<Fortran::parser::MainProgram, false>, Fortran::common::Indirection<Fortran::parser::FunctionSubprogram, false>, Fortran::common::Indirection<Fortran::parser::SubroutineSubprogram, false>, Fortran::common::Indirection<Fortran::parser::Module, false>, Fortran::common::Indirection<Fortran::parser::Submodule, false>, Fortran::common::Indirection<Fortran::parser::BlockData, false>, Fortran::common::Indirection<Fortran::parser::CompilerDirective, false>, Fortran::common::Indirection<Fortran::parser::OpenACCRoutineConstruct, false>>(std::variant<Fortran::common::Indirection<Fortran::parser::MainProgram, false>, Fortran::common::Indirection<Fortran::parser::FunctionSubprogram, false>, Fortran::common::Indirection<Fortran::parser::SubroutineSubprogram, false>, Fortran::common::Indirection<Fortran::parser::Module, false>, Fortran::common::Indirection<Fortran::parser::Submodule, false>, Fortran::common::Indirection<Fortran::parser::BlockData, false>, Fortran::common::Indirection<Fortran::parser::CompilerDirective, false>, Fortran::common::Indirection<Fortran::parser::OpenACCRoutineConstruct, false>> const&, Fortran::semantics::SemanticsVisitor<Fortran::semantics::AccStructureChecker>&)::'lambda'(Fortran::semantics::SemanticsVisitor<Fortran::semantics::AccStructureChecker> const&), std::variant<Fortran::common::Indirection<Fortran::parser::MainProgram, false>, Fortran::common::Indirection<Fortran::parser::FunctionSubprogram, false>, Fortran::common::Indirection<Fortran::parser::SubroutineSubprogram, false>, Fortran::common::Indirection<Fortran::parser::Module, false>, Fortran::common::Indirection<Fortran::parser::Submodule, false>, Fortran::common::Indirection<Fortran::parser::BlockData, false>, Fortran::common::Indirection<Fortran::parser::CompilerDirective, false>, Fortran::common::Indirection<Fortran::parser::OpenACCRoutineConstruct, false>> const&>(void Fortran::parser::detail::ParseTreeVisitorLookupScope::Walk<Fortran::semantics::SemanticsVisitor<Fortran::semantics::AccStructureChecker>, Fortran::common::Indirection<Fortran::parser::MainProgram, false>, Fortran::common::Indirection<Fortran::parser::FunctionSubprogram, false>, Fortran::common::Indirection<Fortran::parser::SubroutineSubprogram, false>, Fortran::common::Indirection<Fortran::parser::Module, false>, Fortran::common::Indirection<Fortran::parser::Submodule, false>, Fortran::common::Indirection<Fortran::parser::BlockData, false>, Fortran::common::Indirection<Fortran::parser::CompilerDirective, false>, Fortran::common::Indirection<Fortran::parser::OpenACCRoutineConstruct, false>>(std::variant<Fortran::common::Indirection<Fortran::parser::MainProgram, false>, Fortran::common::Indirection<Fortran::parser::FunctionSubprogram, false>, Fortran::common::Indirection<Fortran::parser::SubroutineSubprogram, false>, Fortran::common::Indirection<Fortran::parser::Module, false>, Fortran::common::Indirection<Fortran::parser::Submodule, false>, Fortran::common::Indirection<Fortran::parser::BlockData, false>, Fortran::common::Indirection<Fortran::parser::CompilerDirective, false>, Fortran::common::Indirection<Fortran::parser::OpenACCRoutineConstruct, false>> const&, Fortran::semantics::SemanticsVisitor<Fortran::semantics::AccStructureChecker>&)::'lambda'(Fortran::semantics::SemanticsVisitor<Fortran::semantics::AccStructureChecker> const&)&&, unsigned long, std::variant<Fortran::common::Indirection<Fortran::parser::MainProgram, false>, Fortran::common::Indirection<Fortran::parser::FunctionSubprogram, false>, Fortran::common::Indirection<Fortran::parser::SubroutineSubprogram, false>, Fortran::common::Indirection<Fortran::parser::Module, false>, Fortran::common::Indirection<Fortran::parser::Submodule, false>, Fortran::common::Indirection<Fortran::parser::BlockData, false>, Fortran::common::Indirection<Fortran::parser::CompilerDirective, false>, Fortran::common::Indirection<Fortran::parser::OpenACCRoutineConstruct, false>> const&) (/cefs/fb/fba5fba48770ecd1ded31708_clang-llvmflang-trunk-20251124/bin/flang+0x4fa27d4)
#10 0x0000000004fb5595 Fortran::semantics::Semantics::Perform() (/cefs/fb/fba5fba48770ecd1ded31708_clang-llvmflang-trunk-20251124/bin/flang+0x4fb5595)
#11 0x000000000447ee88 Fortran::frontend::FrontendAction::runSemanticChecks() (/cefs/fb/fba5fba48770ecd1ded31708_clang-llvmflang-trunk-20251124/bin/flang+0x447ee88)
#12 0x00000000047276a0 Fortran::frontend::CodeGenAction::beginSourceFileAction() (/cefs/fb/fba5fba48770ecd1ded31708_clang-llvmflang-trunk-20251124/bin/flang+0x47276a0)
#13 0x000000000447dae5 Fortran::frontend::FrontendAction::beginSourceFile(Fortran::frontend::CompilerInstance&, Fortran::frontend::FrontendInputFile const&) (/cefs/fb/fba5fba48770ecd1ded31708_clang-llvmflang-trunk-20251124/bin/flang+0x447dae5)
#14 0x000000000446afaf Fortran::frontend::CompilerInstance::executeAction(Fortran::frontend::FrontendAction&) (/cefs/fb/fba5fba48770ecd1ded31708_clang-llvmflang-trunk-20251124/bin/flang+0x446afaf)
#15 0x0000000004487433 Fortran::frontend::executeCompilerInvocation(Fortran::frontend::CompilerInstance*) (/cefs/fb/fba5fba48770ecd1ded31708_clang-llvmflang-trunk-20251124/bin/flang+0x4487433)
#16 0x0000000002723282 fc1_main(llvm::ArrayRef<char const*>, char const*) (/cefs/fb/fba5fba48770ecd1ded31708_clang-llvmflang-trunk-20251124/bin/flang+0x2723282)
#17 0x00000000025b6041 main (/cefs/fb/fba5fba48770ecd1ded31708_clang-llvmflang-trunk-20251124/bin/flang+0x25b6041)
#18 0x0000741e58a29d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#19 0x0000741e58a29e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#20 0x0000000002721d35 _start (/cefs/fb/fba5fba48770ecd1ded31708_clang-llvmflang-trunk-20251124/bin/flang+0x2721d35)
flang-22: error: unable to execute command: Segmentation fault (core dumped)
flang-22: error: flang frontend command failed due to signal (use -v to see invocation)
flang version 22.0.0git (https://github.com/llvm/llvm-project.git 3c3e2a295254603c5fef271135cbe733139e78eb)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /cefs/fb/fba5fba48770ecd1ded31708_clang-llvmflang-trunk-20251124/bin
flang-22: note: diagnostic msg:

Metadata

Metadata

Labels

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

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions