Issue 159554
Summary [Flang] fatal internal error: CHECK(p) failed at /root/llvm-project/flang/include/flang/Semantics/symbol.h(869)
Labels flang:frontend, crash
Assignees
Reporter k-arrows
    Reproducer:
https://godbolt.org/z/1focfKbac
```f90
use, intrinsic :: iso_c_binding

interface c_funloc
  function c_funloc()
 end function
end interface

end
```

Backtrace:
```console
fatal internal error: CHECK(p) failed at /root/llvm-project/flang/include/flang/Semantics/symbol.h(869)
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/93/93e8d16aa784b1659a61a5b2_clang-llvmflang-trunk-20250918/bin/flang -fc1 -triple x86_64-unknown-linux-gnu -S -mrelocation-model pic -pic-level 2 -pic-is-pie -target-cpu x86-64 -mllvm -x86-asm-syntax=intel -resource-dir /cefs/93/93e8d16aa784b1659a61a5b2_clang-llvmflang-trunk-20250918/lib/clang/22 -mframe-pointer=all -o /app/output.s -x f95 /app/example.f90
 #0 0x0000000004238cc8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/cefs/93/93e8d16aa784b1659a61a5b2_clang-llvmflang-trunk-20250918/bin/flang+0x4238cc8)
 #1 0x0000000004235e94 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
 #2 0x000075d62cc42520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #3 0x000075d62cc969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
 #4 0x000075d62cc42476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
 #5 0x000075d62cc287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
 #6 0x000000000637eee9 (/cefs/93/93e8d16aa784b1659a61a5b2_clang-llvmflang-trunk-20250918/bin/flang+0x637eee9)
 #7 0x0000000004cc29f2 Fortran::semantics::SubprogramVisitor::PushSubprogramScope(Fortran::parser::Name const&, Fortran::semantics::Symbol::Flag, Fortran::parser::LanguageBindingSpec const*, bool) (/cefs/93/93e8d16aa784b1659a61a5b2_clang-llvmflang-trunk-20250918/bin/flang+0x4cc29f2)
 #8 0x0000000004cc2da8 Fortran::semantics::SubprogramVisitor::BeginSubprogram(Fortran::parser::Name const&, Fortran::semantics::Symbol::Flag, bool, Fortran::parser::LanguageBindingSpec const*, std::__cxx11::list<Fortran::common::Reference<Fortran::parser::EntryStmt const>, std::allocator<Fortran::common::Reference<Fortran::parser::EntryStmt const>>> const*) (/cefs/93/93e8d16aa784b1659a61a5b2_clang-llvmflang-trunk-20250918/bin/flang+0x4cc2da8)
 #9 0x0000000004d06923 void Fortran::parser::detail::ParseTreeVisitorLookupScope::Walk<Fortran::parser::InterfaceSpecification, Fortran::semantics::ResolveNamesVisitor>(std::__cxx11::list<Fortran::parser::InterfaceSpecification, std::allocator<Fortran::parser::InterfaceSpecification>> const&, Fortran::semantics::ResolveNamesVisitor&) (/cefs/93/93e8d16aa784b1659a61a5b2_clang-llvmflang-trunk-20250918/bin/flang+0x4d06923)
#10 0x0000000004d07710 void Fortran::common::log2visit::Log2VisitHelper<0ul, 6ul, void, void Fortran::parser::detail::ParseTreeVisitorLookupScope::Walk<Fortran::semantics::ResolveNamesVisitor, Fortran::common::Indirection<Fortran::parser::DerivedTypeDef, false>, Fortran::common::Indirection<Fortran::parser::EnumDef, false>, Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::GenericStmt, false>>, Fortran::common::Indirection<Fortran::parser::InterfaceBlock, false>, Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::ParameterStmt, false>>, Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::OldParameterStmt, false>>, Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::ProcedureDeclarationStmt, false>>, Fortran::parser::Statement<Fortran::parser::OtherSpecificationStmt>, Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::TypeDeclarationStmt, false>>, Fortran::common::Indirection<Fortran::parser::StructureDef, false>, Fortran::common::Indirection<Fortran::parser::OpenACCDeclarativeConstruct, false>, Fortran::common::Indirection<Fortran::parser::OpenMPDeclarativeConstruct, false>, Fortran::common::Indirection<Fortran::parser::CompilerDirective, false>>(std::variant<Fortran::common::Indirection<Fortran::parser::DerivedTypeDef, false>, Fortran::common::Indirection<Fortran::parser::EnumDef, false>, Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::GenericStmt, false>>, Fortran::common::Indirection<Fortran::parser::InterfaceBlock, false>, Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::ParameterStmt, false>>, Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::OldParameterStmt, false>>, Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::ProcedureDeclarationStmt, false>>, Fortran::parser::Statement<Fortran::parser::OtherSpecificationStmt>, Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::TypeDeclarationStmt, false>>, Fortran::common::Indirection<Fortran::parser::StructureDef, false>, Fortran::common::Indirection<Fortran::parser::OpenACCDeclarativeConstruct, false>, Fortran::common::Indirection<Fortran::parser::OpenMPDeclarativeConstruct, false>, Fortran::common::Indirection<Fortran::parser::CompilerDirective, false>> const&, Fortran::semantics::ResolveNamesVisitor&)::'lambda'(Fortran::semantics::ResolveNamesVisitor const&), std::variant<Fortran::common::Indirection<Fortran::parser::DerivedTypeDef, false>, Fortran::common::Indirection<Fortran::parser::EnumDef, false>, Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::GenericStmt, false>>, Fortran::common::Indirection<Fortran::parser::InterfaceBlock, false>, Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::ParameterStmt, false>>, Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::OldParameterStmt, false>>, Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::ProcedureDeclarationStmt, false>>, Fortran::parser::Statement<Fortran::parser::OtherSpecificationStmt>, Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::TypeDeclarationStmt, false>>, Fortran::common::Indirection<Fortran::parser::StructureDef, false>, Fortran::common::Indirection<Fortran::parser::OpenACCDeclarativeConstruct, false>, Fortran::common::Indirection<Fortran::parser::OpenMPDeclarativeConstruct, false>, Fortran::common::Indirection<Fortran::parser::CompilerDirective, false>> const&>(void Fortran::parser::detail::ParseTreeVisitorLookupScope::Walk<Fortran::semantics::ResolveNamesVisitor, Fortran::common::Indirection<Fortran::parser::DerivedTypeDef, false>, Fortran::common::Indirection<Fortran::parser::EnumDef, false>, Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::GenericStmt, false>>, Fortran::common::Indirection<Fortran::parser::InterfaceBlock, false>, Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::ParameterStmt, false>>, Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::OldParameterStmt, false>>, Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::ProcedureDeclarationStmt, false>>, Fortran::parser::Statement<Fortran::parser::OtherSpecificationStmt>, Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::TypeDeclarationStmt, false>>, Fortran::common::Indirection<Fortran::parser::StructureDef, false>, Fortran::common::Indirection<Fortran::parser::OpenACCDeclarativeConstruct, false>, Fortran::common::Indirection<Fortran::parser::OpenMPDeclarativeConstruct, false>, Fortran::common::Indirection<Fortran::parser::CompilerDirective, false>>(std::variant<Fortran::common::Indirection<Fortran::parser::DerivedTypeDef, false>, Fortran::common::Indirection<Fortran::parser::EnumDef, false>, Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::GenericStmt, false>>, Fortran::common::Indirection<Fortran::parser::InterfaceBlock, false>, Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::ParameterStmt, false>>, Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::OldParameterStmt, false>>, Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::ProcedureDeclarationStmt, false>>, Fortran::parser::Statement<Fortran::parser::OtherSpecificationStmt>, Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::TypeDeclarationStmt, false>>, Fortran::common::Indirection<Fortran::parser::StructureDef, false>, Fortran::common::Indirection<Fortran::parser::OpenACCDeclarativeConstruct, false>, Fortran::common::Indirection<Fortran::parser::OpenMPDeclarativeConstruct, false>, Fortran::common::Indirection<Fortran::parser::CompilerDirective, false>> const&, Fortran::semantics::ResolveNamesVisitor&)::'lambda'(Fortran::semantics::ResolveNamesVisitor const&)&&, unsigned long, std::variant<Fortran::common::Indirection<Fortran::parser::DerivedTypeDef, false>, Fortran::common::Indirection<Fortran::parser::EnumDef, false>, Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::GenericStmt, false>>, Fortran::common::Indirection<Fortran::parser::InterfaceBlock, false>, Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::ParameterStmt, false>>, Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::OldParameterStmt, false>>, Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::ProcedureDeclarationStmt, false>>, Fortran::parser::Statement<Fortran::parser::OtherSpecificationStmt>, Fortran::parser::Statement<Fortran::common::Indirection<Fortran::parser::TypeDeclarationStmt, false>>, Fortran::common::Indirection<Fortran::parser::StructureDef, false>, Fortran::common::Indirection<Fortran::parser::OpenACCDeclarativeConstruct, false>, Fortran::common::Indirection<Fortran::parser::OpenMPDeclarativeConstruct, false>, Fortran::common::Indirection<Fortran::parser::CompilerDirective, false>> const&) (/cefs/93/93e8d16aa784b1659a61a5b2_clang-llvmflang-trunk-20250918/bin/flang+0x4d07710)
#11 0x0000000004d08421 void Fortran::parser::detail::ParseTreeVisitorLookupScope::Walk<Fortran::parser::DeclarationConstruct, Fortran::semantics::ResolveNamesVisitor>(std::__cxx11::list<Fortran::parser::DeclarationConstruct, std::allocator<Fortran::parser::DeclarationConstruct>> const&, Fortran::semantics::ResolveNamesVisitor&) (/cefs/93/93e8d16aa784b1659a61a5b2_clang-llvmflang-trunk-20250918/bin/flang+0x4d08421)
#12 0x0000000004d055ca Fortran::semantics::ResolveNamesVisitor::Pre(Fortran::parser::SpecificationPart const&) (/cefs/93/93e8d16aa784b1659a61a5b2_clang-llvmflang-trunk-20250918/bin/flang+0x4d055ca)
#13 0x0000000004d061c2 std::enable_if<TupleTrait<Fortran::parser::SpecificationPart>, void>::type Fortran::parser::detail::ParseTreeVisitorLookupScope::Walk<Fortran::parser::SpecificationPart, Fortran::semantics::ResolveNamesVisitor>(Fortran::parser::SpecificationPart const&, Fortran::semantics::ResolveNamesVisitor&) (/cefs/93/93e8d16aa784b1659a61a5b2_clang-llvmflang-trunk-20250918/bin/flang+0x4d061c2)
#14 0x0000000004d27fd4 Fortran::semantics::ResolveNamesVisitor::ResolveSpecificationParts(Fortran::semantics::ProgramTree&) (.part.0) resolve-names.cpp:0:0
#15 0x0000000004d288a3 Fortran::semantics::ResolveNamesVisitor::Pre(Fortran::parser::ProgramUnit const&) (/cefs/93/93e8d16aa784b1659a61a5b2_clang-llvmflang-trunk-20250918/bin/flang+0x4d288a3)
#16 0x0000000004d29e29 Fortran::semantics::ResolveNames(Fortran::semantics::SemanticsContext&, Fortran::parser::Program const&, Fortran::semantics::Scope&) (/cefs/93/93e8d16aa784b1659a61a5b2_clang-llvmflang-trunk-20250918/bin/flang+0x4d29e29)
#17 0x0000000004daf50e Fortran::semantics::Semantics::Perform() (/cefs/93/93e8d16aa784b1659a61a5b2_clang-llvmflang-trunk-20250918/bin/flang+0x4daf50e)
#18 0x0000000004297e48 Fortran::frontend::FrontendAction::runSemanticChecks() (/cefs/93/93e8d16aa784b1659a61a5b2_clang-llvmflang-trunk-20250918/bin/flang+0x4297e48)
#19 0x0000000004535190 Fortran::frontend::CodeGenAction::beginSourceFileAction() (/cefs/93/93e8d16aa784b1659a61a5b2_clang-llvmflang-trunk-20250918/bin/flang+0x4535190)
#20 0x0000000004296aa5 Fortran::frontend::FrontendAction::beginSourceFile(Fortran::frontend::CompilerInstance&, Fortran::frontend::FrontendInputFile const&) (/cefs/93/93e8d16aa784b1659a61a5b2_clang-llvmflang-trunk-20250918/bin/flang+0x4296aa5)
#21 0x000000000428443f Fortran::frontend::CompilerInstance::executeAction(Fortran::frontend::FrontendAction&) (/cefs/93/93e8d16aa784b1659a61a5b2_clang-llvmflang-trunk-20250918/bin/flang+0x428443f)
#22 0x00000000042a044b Fortran::frontend::executeCompilerInvocation(Fortran::frontend::CompilerInstance*) (/cefs/93/93e8d16aa784b1659a61a5b2_clang-llvmflang-trunk-20250918/bin/flang+0x42a044b)
#23 0x0000000002597ce2 fc1_main(llvm::ArrayRef<char const*>, char const*) (/cefs/93/93e8d16aa784b1659a61a5b2_clang-llvmflang-trunk-20250918/bin/flang+0x2597ce2)
#24 0x000000000242ee91 main (/cefs/93/93e8d16aa784b1659a61a5b2_clang-llvmflang-trunk-20250918/bin/flang+0x242ee91)
#25 0x000075d62cc29d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#26 0x000075d62cc29e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#27 0x00000000025966d5 _start (/cefs/93/93e8d16aa784b1659a61a5b2_clang-llvmflang-trunk-20250918/bin/flang+0x25966d5)
flang-22: error: unable to execute command: Aborted (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 38f2a1cb9b25ef2967661865458d6a919ce82aaa)
Target: x86_64-unknown-linux-gnu
Thread model: posix
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to