Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Flang] llvm-project/flang/lib/Lower/CallInterface.cpp:541: Fortran::evaluate::characteristics::Procedure Fortran::lower::CalleeInterface::characterize() const: Assertion `characteristic && "Fail to get characteristic from symbol"' failed. #91845

Closed
k-arrows opened this issue May 11, 2024 · 3 comments · Fixed by #92008
Assignees
Labels
bug Indicates an unexpected problem or unintended behavior crash Prefer [crash-on-valid] or [crash-on-invalid] flang:frontend

Comments

@k-arrows
Copy link

Crash itself is reproducible on Godbolt:
https://godbolt.org/z/7vWE6o8ab

With assertion-enabled flang-new, the following assertion failure was observed.

flang-new: /path_to_llvm_project/llvm-project/flang/lib/Lower/CallInterface.cpp:541: Fortran::evaluate::characteristics::Procedure Fortran::lower::CalleeInterface::characterize() const: Assertion `characteristic && "Fail to get characteristic from symbol"' failed.

Reproducer:

$ cat test.f90
module m
    contains
        subroutine s1(a1)
            procedure(s2) :: a1
        end subroutine
        subroutine s2(a2)
            procedure(s1) :: a2
        end subroutine
end module

Stack dump from Godbolt:

terminate called after throwing an instance of 'std::bad_alloc'
  what():  std::bad_alloc
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.	Program arguments: /opt/compiler-explorer/clang-llvmflang-trunk-20240511/bin/flang-new -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 /opt/compiler-explorer/clang-llvmflang-trunk-20240511/lib/clang/19 -mframe-pointer=all -o /app/output.s -x f95-cpp-input /app/example.f90
 #0 0x0000000003796638 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-llvmflang-trunk-20240511/bin/flang-new+0x3796638)
 #1 0x0000000003793fac SignalHandler(int) Signals.cpp:0:0
 #2 0x000075af93242520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #3 0x000075af932969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
 #4 0x000075af93242476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
 #5 0x000075af932287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
 #6 0x000075af93773bfd (/opt/compiler-explorer/gcc-snapshot/lib64/libstdc++.so.6+0xadbfd)
 #7 0x000075af93784f7a (/opt/compiler-explorer/gcc-snapshot/lib64/libstdc++.so.6+0xbef7a)
 #8 0x000075af937737a9 std::unexpected() (/opt/compiler-explorer/gcc-snapshot/lib64/libstdc++.so.6+0xad7a9)
 #9 0x000075af937851f7 (/opt/compiler-explorer/gcc-snapshot/lib64/libstdc++.so.6+0xbf1f7)
#10 0x000075af93776229 std::__throw_bad_array_new_length() (/opt/compiler-explorer/gcc-snapshot/lib64/libstdc++.so.6+0xb0229)
#11 0x00000000043879c1 (/opt/compiler-explorer/clang-llvmflang-trunk-20240511/bin/flang-new+0x43879c1)
#12 0x000000000438a0f7 Fortran::evaluate::characteristics::Procedure::Procedure(Fortran::evaluate::characteristics::Procedure const&) (/opt/compiler-explorer/clang-llvmflang-trunk-20240511/bin/flang-new+0x438a0f7)
#13 0x0000000003bacc8b Fortran::lower::CalleeInterface::characterize() const (/opt/compiler-explorer/clang-llvmflang-trunk-20240511/bin/flang-new+0x3bacc8b)
#14 0x0000000003bb6b78 Fortran::lower::CallInterface<Fortran::lower::CalleeInterface>::declare() (/opt/compiler-explorer/clang-llvmflang-trunk-20240511/bin/flang-new+0x3bb6b78)
#15 0x0000000003b6cfeb (anonymous namespace)::FirConverter::declareFunction(Fortran::lower::pft::FunctionLikeUnit&) Bridge.cpp:0:0
#16 0x0000000003b71836 std::__detail::__variant::__gen_vtable_impl<true, std::__detail::__variant::_Multi_array<void (*)(Fortran::common::visitors<(anonymous namespace)::FirConverter::run(Fortran::lower::pft::Program&)::'lambda'(Fortran::lower::pft::FunctionLikeUnit&), (anonymous namespace)::FirConverter::run(Fortran::lower::pft::Program&)::'lambda0'(Fortran::lower::pft::ModuleLikeUnit&), (anonymous namespace)::FirConverter::run(Fortran::lower::pft::Program&)::'lambda1'(Fortran::lower::pft::BlockDataUnit&), (anonymous namespace)::FirConverter::run(Fortran::lower::pft::Program&)::'lambda2'(Fortran::lower::pft::CompilerDirectiveUnit&), (anonymous namespace)::FirConverter::run(Fortran::lower::pft::Program&)::'lambda3'(Fortran::lower::pft::OpenACCDirectiveUnit&)>&&, std::variant<Fortran::lower::pft::FunctionLikeUnit, Fortran::lower::pft::ModuleLikeUnit, Fortran::lower::pft::BlockDataUnit, Fortran::lower::pft::CompilerDirectiveUnit, Fortran::lower::pft::OpenACCDirectiveUnit>&)>, std::tuple<std::variant<Fortran::lower::pft::FunctionLikeUnit, Fortran::lower::pft::ModuleLikeUnit, Fortran::lower::pft::BlockDataUnit, Fortran::lower::pft::CompilerDirectiveUnit, Fortran::lower::pft::OpenACCDirectiveUnit>&>, std::integer_sequence<unsigned long, 1ul>>::__visit_invoke(Fortran::common::visitors<(anonymous namespace)::FirConverter::run(Fortran::lower::pft::Program&)::'lambda'(Fortran::lower::pft::FunctionLikeUnit&), (anonymous namespace)::FirConverter::run(Fortran::lower::pft::Program&)::'lambda0'(Fortran::lower::pft::ModuleLikeUnit&), (anonymous namespace)::FirConverter::run(Fortran::lower::pft::Program&)::'lambda1'(Fortran::lower::pft::BlockDataUnit&), (anonymous namespace)::FirConverter::run(Fortran::lower::pft::Program&)::'lambda2'(Fortran::lower::pft::CompilerDirectiveUnit&), (anonymous namespace)::FirConverter::run(Fortran::lower::pft::Program&)::'lambda3'(Fortran::lower::pft::OpenACCDirectiveUnit&)>&&, std::variant<Fortran::lower::pft::FunctionLikeUnit, Fortran::lower::pft::ModuleLikeUnit, Fortran::lower::pft::BlockDataUnit, Fortran::lower::pft::CompilerDirectiveUnit, Fortran::lower::pft::OpenACCDirectiveUnit>&) Bridge.cpp:0:0
#17 0x0000000003b832d5 Fortran::lower::LoweringBridge::lower(Fortran::parser::Program const&, Fortran::semantics::SemanticsContext const&) (/opt/compiler-explorer/clang-llvmflang-trunk-20240511/bin/flang-new+0x3b832d5)
#18 0x0000000003b15039 Fortran::frontend::CodeGenAction::beginSourceFileAction() (/opt/compiler-explorer/clang-llvmflang-trunk-20240511/bin/flang-new+0x3b15039)
#19 0x00000000037e7125 Fortran::frontend::FrontendAction::beginSourceFile(Fortran::frontend::CompilerInstance&, Fortran::frontend::FrontendInputFile const&) (/opt/compiler-explorer/clang-llvmflang-trunk-20240511/bin/flang-new+0x37e7125)
#20 0x00000000037d6b37 Fortran::frontend::CompilerInstance::executeAction(Fortran::frontend::FrontendAction&) (/opt/compiler-explorer/clang-llvmflang-trunk-20240511/bin/flang-new+0x37d6b37)
#21 0x00000000037ed16d Fortran::frontend::executeCompilerInvocation(Fortran::frontend::CompilerInstance*) (/opt/compiler-explorer/clang-llvmflang-trunk-20240511/bin/flang-new+0x37ed16d)
#22 0x0000000001f3f798 fc1_main(llvm::ArrayRef<char const*>, char const*) (/opt/compiler-explorer/clang-llvmflang-trunk-20240511/bin/flang-new+0x1f3f798)
#23 0x0000000001e2db04 main (/opt/compiler-explorer/clang-llvmflang-trunk-20240511/bin/flang-new+0x1e2db04)
#24 0x000075af93229d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#25 0x000075af93229e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#26 0x0000000001f3e6fe _start (/opt/compiler-explorer/clang-llvmflang-trunk-20240511/bin/flang-new+0x1f3e6fe)
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 504cf554639360525c3f746e7296a242350b2af9)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /opt/compiler-explorer/clang-llvmflang-trunk-20240511/bin
@github-actions github-actions bot added the flang Flang issues not falling into any other category label May 11, 2024
@k-arrows k-arrows added flang:frontend crash Prefer [crash-on-valid] or [crash-on-invalid] and removed flang Flang issues not falling into any other category labels May 11, 2024
@llvmbot
Copy link
Collaborator

llvmbot commented May 11, 2024

@llvm/issue-subscribers-flang-frontend

Author: None (k-arrows)

Crash itself is reproducible on Godbolt: https://godbolt.org/z/7vWE6o8ab

With assertion-enabled flang-new, the following assertion failure was observed.

flang-new: /path_to_llvm_project/llvm-project/flang/lib/Lower/CallInterface.cpp:541: Fortran::evaluate::characteristics::Procedure Fortran::lower::CalleeInterface::characterize() const: Assertion `characteristic &amp;&amp; "Fail to get characteristic from symbol"' failed.

Reproducer:

$ cat test.f90
module m
    contains
        subroutine s1(a1)
            procedure(s2) :: a1
        end subroutine
        subroutine s2(a2)
            procedure(s1) :: a2
        end subroutine
end module

Stack dump from Godbolt:

terminate called after throwing an instance of 'std::bad_alloc'
  what():  std::bad_alloc
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.	Program arguments: /opt/compiler-explorer/clang-llvmflang-trunk-20240511/bin/flang-new -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 /opt/compiler-explorer/clang-llvmflang-trunk-20240511/lib/clang/19 -mframe-pointer=all -o /app/output.s -x f95-cpp-input /app/example.f90
 #<!-- -->0 0x0000000003796638 llvm::sys::PrintStackTrace(llvm::raw_ostream&amp;, int) (/opt/compiler-explorer/clang-llvmflang-trunk-20240511/bin/flang-new+0x3796638)
 #<!-- -->1 0x0000000003793fac SignalHandler(int) Signals.cpp:0:0
 #<!-- -->2 0x000075af93242520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #<!-- -->3 0x000075af932969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
 #<!-- -->4 0x000075af93242476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
 #<!-- -->5 0x000075af932287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
 #<!-- -->6 0x000075af93773bfd (/opt/compiler-explorer/gcc-snapshot/lib64/libstdc++.so.6+0xadbfd)
 #<!-- -->7 0x000075af93784f7a (/opt/compiler-explorer/gcc-snapshot/lib64/libstdc++.so.6+0xbef7a)
 #<!-- -->8 0x000075af937737a9 std::unexpected() (/opt/compiler-explorer/gcc-snapshot/lib64/libstdc++.so.6+0xad7a9)
 #<!-- -->9 0x000075af937851f7 (/opt/compiler-explorer/gcc-snapshot/lib64/libstdc++.so.6+0xbf1f7)
#<!-- -->10 0x000075af93776229 std::__throw_bad_array_new_length() (/opt/compiler-explorer/gcc-snapshot/lib64/libstdc++.so.6+0xb0229)
#<!-- -->11 0x00000000043879c1 (/opt/compiler-explorer/clang-llvmflang-trunk-20240511/bin/flang-new+0x43879c1)
#<!-- -->12 0x000000000438a0f7 Fortran::evaluate::characteristics::Procedure::Procedure(Fortran::evaluate::characteristics::Procedure const&amp;) (/opt/compiler-explorer/clang-llvmflang-trunk-20240511/bin/flang-new+0x438a0f7)
#<!-- -->13 0x0000000003bacc8b Fortran::lower::CalleeInterface::characterize() const (/opt/compiler-explorer/clang-llvmflang-trunk-20240511/bin/flang-new+0x3bacc8b)
#<!-- -->14 0x0000000003bb6b78 Fortran::lower::CallInterface&lt;Fortran::lower::CalleeInterface&gt;::declare() (/opt/compiler-explorer/clang-llvmflang-trunk-20240511/bin/flang-new+0x3bb6b78)
#<!-- -->15 0x0000000003b6cfeb (anonymous namespace)::FirConverter::declareFunction(Fortran::lower::pft::FunctionLikeUnit&amp;) Bridge.cpp:0:0
#<!-- -->16 0x0000000003b71836 std::__detail::__variant::__gen_vtable_impl&lt;true, std::__detail::__variant::_Multi_array&lt;void (*)(Fortran::common::visitors&lt;(anonymous namespace)::FirConverter::run(Fortran::lower::pft::Program&amp;)::'lambda'(Fortran::lower::pft::FunctionLikeUnit&amp;), (anonymous namespace)::FirConverter::run(Fortran::lower::pft::Program&amp;)::'lambda0'(Fortran::lower::pft::ModuleLikeUnit&amp;), (anonymous namespace)::FirConverter::run(Fortran::lower::pft::Program&amp;)::'lambda1'(Fortran::lower::pft::BlockDataUnit&amp;), (anonymous namespace)::FirConverter::run(Fortran::lower::pft::Program&amp;)::'lambda2'(Fortran::lower::pft::CompilerDirectiveUnit&amp;), (anonymous namespace)::FirConverter::run(Fortran::lower::pft::Program&amp;)::'lambda3'(Fortran::lower::pft::OpenACCDirectiveUnit&amp;)&gt;&amp;&amp;, std::variant&lt;Fortran::lower::pft::FunctionLikeUnit, Fortran::lower::pft::ModuleLikeUnit, Fortran::lower::pft::BlockDataUnit, Fortran::lower::pft::CompilerDirectiveUnit, Fortran::lower::pft::OpenACCDirectiveUnit&gt;&amp;)&gt;, std::tuple&lt;std::variant&lt;Fortran::lower::pft::FunctionLikeUnit, Fortran::lower::pft::ModuleLikeUnit, Fortran::lower::pft::BlockDataUnit, Fortran::lower::pft::CompilerDirectiveUnit, Fortran::lower::pft::OpenACCDirectiveUnit&gt;&amp;&gt;, std::integer_sequence&lt;unsigned long, 1ul&gt;&gt;::__visit_invoke(Fortran::common::visitors&lt;(anonymous namespace)::FirConverter::run(Fortran::lower::pft::Program&amp;)::'lambda'(Fortran::lower::pft::FunctionLikeUnit&amp;), (anonymous namespace)::FirConverter::run(Fortran::lower::pft::Program&amp;)::'lambda0'(Fortran::lower::pft::ModuleLikeUnit&amp;), (anonymous namespace)::FirConverter::run(Fortran::lower::pft::Program&amp;)::'lambda1'(Fortran::lower::pft::BlockDataUnit&amp;), (anonymous namespace)::FirConverter::run(Fortran::lower::pft::Program&amp;)::'lambda2'(Fortran::lower::pft::CompilerDirectiveUnit&amp;), (anonymous namespace)::FirConverter::run(Fortran::lower::pft::Program&amp;)::'lambda3'(Fortran::lower::pft::OpenACCDirectiveUnit&amp;)&gt;&amp;&amp;, std::variant&lt;Fortran::lower::pft::FunctionLikeUnit, Fortran::lower::pft::ModuleLikeUnit, Fortran::lower::pft::BlockDataUnit, Fortran::lower::pft::CompilerDirectiveUnit, Fortran::lower::pft::OpenACCDirectiveUnit&gt;&amp;) Bridge.cpp:0:0
#<!-- -->17 0x0000000003b832d5 Fortran::lower::LoweringBridge::lower(Fortran::parser::Program const&amp;, Fortran::semantics::SemanticsContext const&amp;) (/opt/compiler-explorer/clang-llvmflang-trunk-20240511/bin/flang-new+0x3b832d5)
#<!-- -->18 0x0000000003b15039 Fortran::frontend::CodeGenAction::beginSourceFileAction() (/opt/compiler-explorer/clang-llvmflang-trunk-20240511/bin/flang-new+0x3b15039)
#<!-- -->19 0x00000000037e7125 Fortran::frontend::FrontendAction::beginSourceFile(Fortran::frontend::CompilerInstance&amp;, Fortran::frontend::FrontendInputFile const&amp;) (/opt/compiler-explorer/clang-llvmflang-trunk-20240511/bin/flang-new+0x37e7125)
#<!-- -->20 0x00000000037d6b37 Fortran::frontend::CompilerInstance::executeAction(Fortran::frontend::FrontendAction&amp;) (/opt/compiler-explorer/clang-llvmflang-trunk-20240511/bin/flang-new+0x37d6b37)
#<!-- -->21 0x00000000037ed16d Fortran::frontend::executeCompilerInvocation(Fortran::frontend::CompilerInstance*) (/opt/compiler-explorer/clang-llvmflang-trunk-20240511/bin/flang-new+0x37ed16d)
#<!-- -->22 0x0000000001f3f798 fc1_main(llvm::ArrayRef&lt;char const*&gt;, char const*) (/opt/compiler-explorer/clang-llvmflang-trunk-20240511/bin/flang-new+0x1f3f798)
#<!-- -->23 0x0000000001e2db04 main (/opt/compiler-explorer/clang-llvmflang-trunk-20240511/bin/flang-new+0x1e2db04)
#<!-- -->24 0x000075af93229d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#<!-- -->25 0x000075af93229e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#<!-- -->26 0x0000000001f3e6fe _start (/opt/compiler-explorer/clang-llvmflang-trunk-20240511/bin/flang-new+0x1f3e6fe)
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 504cf554639360525c3f746e7296a242350b2af9)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /opt/compiler-explorer/clang-llvmflang-trunk-20240511/bin

@psteinfeld psteinfeld added the bug Indicates an unexpected problem or unintended behavior label May 11, 2024
@llvmbot
Copy link
Collaborator

llvmbot commented May 11, 2024

@llvm/issue-subscribers-bug

Author: None (k-arrows)

Crash itself is reproducible on Godbolt: https://godbolt.org/z/7vWE6o8ab

With assertion-enabled flang-new, the following assertion failure was observed.

flang-new: /path_to_llvm_project/llvm-project/flang/lib/Lower/CallInterface.cpp:541: Fortran::evaluate::characteristics::Procedure Fortran::lower::CalleeInterface::characterize() const: Assertion `characteristic &amp;&amp; "Fail to get characteristic from symbol"' failed.

Reproducer:

$ cat test.f90
module m
    contains
        subroutine s1(a1)
            procedure(s2) :: a1
        end subroutine
        subroutine s2(a2)
            procedure(s1) :: a2
        end subroutine
end module

Stack dump from Godbolt:

terminate called after throwing an instance of 'std::bad_alloc'
  what():  std::bad_alloc
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.	Program arguments: /opt/compiler-explorer/clang-llvmflang-trunk-20240511/bin/flang-new -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 /opt/compiler-explorer/clang-llvmflang-trunk-20240511/lib/clang/19 -mframe-pointer=all -o /app/output.s -x f95-cpp-input /app/example.f90
 #<!-- -->0 0x0000000003796638 llvm::sys::PrintStackTrace(llvm::raw_ostream&amp;, int) (/opt/compiler-explorer/clang-llvmflang-trunk-20240511/bin/flang-new+0x3796638)
 #<!-- -->1 0x0000000003793fac SignalHandler(int) Signals.cpp:0:0
 #<!-- -->2 0x000075af93242520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #<!-- -->3 0x000075af932969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
 #<!-- -->4 0x000075af93242476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
 #<!-- -->5 0x000075af932287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
 #<!-- -->6 0x000075af93773bfd (/opt/compiler-explorer/gcc-snapshot/lib64/libstdc++.so.6+0xadbfd)
 #<!-- -->7 0x000075af93784f7a (/opt/compiler-explorer/gcc-snapshot/lib64/libstdc++.so.6+0xbef7a)
 #<!-- -->8 0x000075af937737a9 std::unexpected() (/opt/compiler-explorer/gcc-snapshot/lib64/libstdc++.so.6+0xad7a9)
 #<!-- -->9 0x000075af937851f7 (/opt/compiler-explorer/gcc-snapshot/lib64/libstdc++.so.6+0xbf1f7)
#<!-- -->10 0x000075af93776229 std::__throw_bad_array_new_length() (/opt/compiler-explorer/gcc-snapshot/lib64/libstdc++.so.6+0xb0229)
#<!-- -->11 0x00000000043879c1 (/opt/compiler-explorer/clang-llvmflang-trunk-20240511/bin/flang-new+0x43879c1)
#<!-- -->12 0x000000000438a0f7 Fortran::evaluate::characteristics::Procedure::Procedure(Fortran::evaluate::characteristics::Procedure const&amp;) (/opt/compiler-explorer/clang-llvmflang-trunk-20240511/bin/flang-new+0x438a0f7)
#<!-- -->13 0x0000000003bacc8b Fortran::lower::CalleeInterface::characterize() const (/opt/compiler-explorer/clang-llvmflang-trunk-20240511/bin/flang-new+0x3bacc8b)
#<!-- -->14 0x0000000003bb6b78 Fortran::lower::CallInterface&lt;Fortran::lower::CalleeInterface&gt;::declare() (/opt/compiler-explorer/clang-llvmflang-trunk-20240511/bin/flang-new+0x3bb6b78)
#<!-- -->15 0x0000000003b6cfeb (anonymous namespace)::FirConverter::declareFunction(Fortran::lower::pft::FunctionLikeUnit&amp;) Bridge.cpp:0:0
#<!-- -->16 0x0000000003b71836 std::__detail::__variant::__gen_vtable_impl&lt;true, std::__detail::__variant::_Multi_array&lt;void (*)(Fortran::common::visitors&lt;(anonymous namespace)::FirConverter::run(Fortran::lower::pft::Program&amp;)::'lambda'(Fortran::lower::pft::FunctionLikeUnit&amp;), (anonymous namespace)::FirConverter::run(Fortran::lower::pft::Program&amp;)::'lambda0'(Fortran::lower::pft::ModuleLikeUnit&amp;), (anonymous namespace)::FirConverter::run(Fortran::lower::pft::Program&amp;)::'lambda1'(Fortran::lower::pft::BlockDataUnit&amp;), (anonymous namespace)::FirConverter::run(Fortran::lower::pft::Program&amp;)::'lambda2'(Fortran::lower::pft::CompilerDirectiveUnit&amp;), (anonymous namespace)::FirConverter::run(Fortran::lower::pft::Program&amp;)::'lambda3'(Fortran::lower::pft::OpenACCDirectiveUnit&amp;)&gt;&amp;&amp;, std::variant&lt;Fortran::lower::pft::FunctionLikeUnit, Fortran::lower::pft::ModuleLikeUnit, Fortran::lower::pft::BlockDataUnit, Fortran::lower::pft::CompilerDirectiveUnit, Fortran::lower::pft::OpenACCDirectiveUnit&gt;&amp;)&gt;, std::tuple&lt;std::variant&lt;Fortran::lower::pft::FunctionLikeUnit, Fortran::lower::pft::ModuleLikeUnit, Fortran::lower::pft::BlockDataUnit, Fortran::lower::pft::CompilerDirectiveUnit, Fortran::lower::pft::OpenACCDirectiveUnit&gt;&amp;&gt;, std::integer_sequence&lt;unsigned long, 1ul&gt;&gt;::__visit_invoke(Fortran::common::visitors&lt;(anonymous namespace)::FirConverter::run(Fortran::lower::pft::Program&amp;)::'lambda'(Fortran::lower::pft::FunctionLikeUnit&amp;), (anonymous namespace)::FirConverter::run(Fortran::lower::pft::Program&amp;)::'lambda0'(Fortran::lower::pft::ModuleLikeUnit&amp;), (anonymous namespace)::FirConverter::run(Fortran::lower::pft::Program&amp;)::'lambda1'(Fortran::lower::pft::BlockDataUnit&amp;), (anonymous namespace)::FirConverter::run(Fortran::lower::pft::Program&amp;)::'lambda2'(Fortran::lower::pft::CompilerDirectiveUnit&amp;), (anonymous namespace)::FirConverter::run(Fortran::lower::pft::Program&amp;)::'lambda3'(Fortran::lower::pft::OpenACCDirectiveUnit&amp;)&gt;&amp;&amp;, std::variant&lt;Fortran::lower::pft::FunctionLikeUnit, Fortran::lower::pft::ModuleLikeUnit, Fortran::lower::pft::BlockDataUnit, Fortran::lower::pft::CompilerDirectiveUnit, Fortran::lower::pft::OpenACCDirectiveUnit&gt;&amp;) Bridge.cpp:0:0
#<!-- -->17 0x0000000003b832d5 Fortran::lower::LoweringBridge::lower(Fortran::parser::Program const&amp;, Fortran::semantics::SemanticsContext const&amp;) (/opt/compiler-explorer/clang-llvmflang-trunk-20240511/bin/flang-new+0x3b832d5)
#<!-- -->18 0x0000000003b15039 Fortran::frontend::CodeGenAction::beginSourceFileAction() (/opt/compiler-explorer/clang-llvmflang-trunk-20240511/bin/flang-new+0x3b15039)
#<!-- -->19 0x00000000037e7125 Fortran::frontend::FrontendAction::beginSourceFile(Fortran::frontend::CompilerInstance&amp;, Fortran::frontend::FrontendInputFile const&amp;) (/opt/compiler-explorer/clang-llvmflang-trunk-20240511/bin/flang-new+0x37e7125)
#<!-- -->20 0x00000000037d6b37 Fortran::frontend::CompilerInstance::executeAction(Fortran::frontend::FrontendAction&amp;) (/opt/compiler-explorer/clang-llvmflang-trunk-20240511/bin/flang-new+0x37d6b37)
#<!-- -->21 0x00000000037ed16d Fortran::frontend::executeCompilerInvocation(Fortran::frontend::CompilerInstance*) (/opt/compiler-explorer/clang-llvmflang-trunk-20240511/bin/flang-new+0x37ed16d)
#<!-- -->22 0x0000000001f3f798 fc1_main(llvm::ArrayRef&lt;char const*&gt;, char const*) (/opt/compiler-explorer/clang-llvmflang-trunk-20240511/bin/flang-new+0x1f3f798)
#<!-- -->23 0x0000000001e2db04 main (/opt/compiler-explorer/clang-llvmflang-trunk-20240511/bin/flang-new+0x1e2db04)
#<!-- -->24 0x000075af93229d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#<!-- -->25 0x000075af93229e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#<!-- -->26 0x0000000001f3e6fe _start (/opt/compiler-explorer/clang-llvmflang-trunk-20240511/bin/flang-new+0x1f3e6fe)
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 504cf554639360525c3f746e7296a242350b2af9)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /opt/compiler-explorer/clang-llvmflang-trunk-20240511/bin

@klausler klausler self-assigned this May 13, 2024
klausler added a commit to klausler/llvm-project that referenced this issue May 13, 2024
When a procedure is defined with a subprogram but never referenced
in a compilation unit, it may not be characterized until lowering,
and any errors in characterization then may crash the compiler.
So always ensure that procedure definitions are characterizable
in declaration checking.

Fixes llvm#91845.
@klausler
Copy link
Contributor

#92008

klausler added a commit that referenced this issue May 15, 2024
When a procedure is defined with a subprogram but never referenced in a
compilation unit, it may not be characterized until lowering, and any
errors in characterization then may crash the compiler. So always ensure
that procedure definitions are characterizable in declaration checking.

Fixes #91845.
mub-at-arm pushed a commit to mub-at-arm/llvm-project that referenced this issue May 16, 2024
When a procedure is defined with a subprogram but never referenced in a
compilation unit, it may not be characterized until lowering, and any
errors in characterization then may crash the compiler. So always ensure
that procedure definitions are characterizable in declaration checking.

Fixes llvm#91845.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Indicates an unexpected problem or unintended behavior crash Prefer [crash-on-valid] or [crash-on-invalid] flang:frontend
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants