llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
27.15k stars 11.12k forks source link

[Flang] flang-new crashes on a program that includes a submodule #94884

Open k-arrows opened 1 month ago

k-arrows commented 1 month ago

Reproducible on Godbolt: https://godbolt.org/z/38qrv9jxc

Reproducer:

module m
  interface
    module subroutine s
    end
  end interface
end

submodule (m) sm
  procedure(s), pointer :: p
  contains
    module procedure s
    end
end

Stack dump:

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-20240608/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-20240608/bin/.. -mframe-pointer=all -o /app/output.s -x f95-cpp-input /app/example.f90
 #0 0x0000000003850c68 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-llvmflang-trunk-20240608/bin/flang-new+0x3850c68)
 #1 0x000000000384e5dc SignalHandler(int) Signals.cpp:0:0
 #2 0x00007d2049a42520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #3 0x00007d2049a969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
 #4 0x00007d2049a42476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
 #5 0x00007d2049a287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
 #6 0x0000000001e8f6d2 Fortran::lower::getOrDeclareFunction(Fortran::evaluate::ProcedureDesignator const&, Fortran::lower::AbstractConverter&) (.cold) CallInterface.cpp:0:0
 #7 0x0000000003e96c10 (anonymous namespace)::TypeBuilderImpl::genSymbolType(Fortran::semantics::Symbol const&, bool, bool) ConvertType.cpp:0:0
 #8 0x0000000003e97b26 Fortran::lower::translateVariableToFIRType(Fortran::lower::AbstractConverter&, Fortran::lower::pft::Variable const&) (/opt/compiler-explorer/clang-llvmflang-trunk-20240608/bin/flang-new+0x3e97b26)
 #9 0x0000000003eaeae1 defineGlobal(Fortran::lower::AbstractConverter&, Fortran::lower::pft::Variable const&, llvm::StringRef, mlir::StringAttr, cuf::DataAttributeAttr) ConvertVariable.cpp:0:0
#10 0x0000000003eaf88a Fortran::lower::defineModuleVariable(Fortran::lower::AbstractConverter&, Fortran::lower::pft::Variable const&) (/opt/compiler-explorer/clang-llvmflang-trunk-20240608/bin/flang-new+0x3eaf88a)
#11 0x0000000003c2d8fb std::_Function_handler<void (), (anonymous namespace)::FirConverter::lowerModuleDeclScope(Fortran::lower::pft::ModuleLikeUnit&)::'lambda'()>::_M_invoke(std::_Any_data const&) Bridge.cpp:0:0
#12 0x0000000003c2c3f6 (anonymous namespace)::FirConverter::createGlobalOutsideOfFunctionLowering(std::function<void ()> const&) Bridge.cpp:0:0
#13 0x0000000003c2c8b0 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
#14 0x0000000003c3ed55 Fortran::lower::LoweringBridge::lower(Fortran::parser::Program const&, Fortran::semantics::SemanticsContext const&) (/opt/compiler-explorer/clang-llvmflang-trunk-20240608/bin/flang-new+0x3c3ed55)
#15 0x0000000003bd0daa Fortran::frontend::CodeGenAction::beginSourceFileAction() (/opt/compiler-explorer/clang-llvmflang-trunk-20240608/bin/flang-new+0x3bd0daa)
#16 0x00000000038a19d5 Fortran::frontend::FrontendAction::beginSourceFile(Fortran::frontend::CompilerInstance&, Fortran::frontend::FrontendInputFile const&) (/opt/compiler-explorer/clang-llvmflang-trunk-20240608/bin/flang-new+0x38a19d5)
#17 0x0000000003891337 Fortran::frontend::CompilerInstance::executeAction(Fortran::frontend::FrontendAction&) (/opt/compiler-explorer/clang-llvmflang-trunk-20240608/bin/flang-new+0x3891337)
#18 0x00000000038a7a1d Fortran::frontend::executeCompilerInvocation(Fortran::frontend::CompilerInstance*) (/opt/compiler-explorer/clang-llvmflang-trunk-20240608/bin/flang-new+0x38a7a1d)
#19 0x0000000001fdd798 fc1_main(llvm::ArrayRef<char const*>, char const*) (/opt/compiler-explorer/clang-llvmflang-trunk-20240608/bin/flang-new+0x1fdd798)
#20 0x0000000001ec5b54 main (/opt/compiler-explorer/clang-llvmflang-trunk-20240608/bin/flang-new+0x1ec5b54)
#21 0x00007d2049a29d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#22 0x00007d2049a29e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#23 0x0000000001fdc6fe _start (/opt/compiler-explorer/clang-llvmflang-trunk-20240608/bin/flang-new+0x1fdc6fe)
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 435dd9746107e13c2ad019be3bd34815f7d2360d)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /opt/compiler-explorer/clang-llvmflang-trunk-20240608/bin
llvmbot commented 1 month ago

@llvm/issue-subscribers-flang-frontend

Author: None (k-arrows)

Reproducible on Godbolt: https://godbolt.org/z/38qrv9jxc Reproducer: ```console module m interface module subroutine s end end interface end submodule (m) sm procedure(s), pointer :: p contains module procedure s end end ``` Stack dump: ```console 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-20240608/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-20240608/bin/.. -mframe-pointer=all -o /app/output.s -x f95-cpp-input /app/example.f90 #0 0x0000000003850c68 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-llvmflang-trunk-20240608/bin/flang-new+0x3850c68) #1 0x000000000384e5dc SignalHandler(int) Signals.cpp:0:0 #2 0x00007d2049a42520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520) #3 0x00007d2049a969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc) #4 0x00007d2049a42476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476) #5 0x00007d2049a287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3) #6 0x0000000001e8f6d2 Fortran::lower::getOrDeclareFunction(Fortran::evaluate::ProcedureDesignator const&, Fortran::lower::AbstractConverter&) (.cold) CallInterface.cpp:0:0 #7 0x0000000003e96c10 (anonymous namespace)::TypeBuilderImpl::genSymbolType(Fortran::semantics::Symbol const&, bool, bool) ConvertType.cpp:0:0 #8 0x0000000003e97b26 Fortran::lower::translateVariableToFIRType(Fortran::lower::AbstractConverter&, Fortran::lower::pft::Variable const&) (/opt/compiler-explorer/clang-llvmflang-trunk-20240608/bin/flang-new+0x3e97b26) #9 0x0000000003eaeae1 defineGlobal(Fortran::lower::AbstractConverter&, Fortran::lower::pft::Variable const&, llvm::StringRef, mlir::StringAttr, cuf::DataAttributeAttr) ConvertVariable.cpp:0:0 #10 0x0000000003eaf88a Fortran::lower::defineModuleVariable(Fortran::lower::AbstractConverter&, Fortran::lower::pft::Variable const&) (/opt/compiler-explorer/clang-llvmflang-trunk-20240608/bin/flang-new+0x3eaf88a) #11 0x0000000003c2d8fb std::_Function_handler<void (), (anonymous namespace)::FirConverter::lowerModuleDeclScope(Fortran::lower::pft::ModuleLikeUnit&)::'lambda'()>::_M_invoke(std::_Any_data const&) Bridge.cpp:0:0 #12 0x0000000003c2c3f6 (anonymous namespace)::FirConverter::createGlobalOutsideOfFunctionLowering(std::function<void ()> const&) Bridge.cpp:0:0 #13 0x0000000003c2c8b0 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 #14 0x0000000003c3ed55 Fortran::lower::LoweringBridge::lower(Fortran::parser::Program const&, Fortran::semantics::SemanticsContext const&) (/opt/compiler-explorer/clang-llvmflang-trunk-20240608/bin/flang-new+0x3c3ed55) #15 0x0000000003bd0daa Fortran::frontend::CodeGenAction::beginSourceFileAction() (/opt/compiler-explorer/clang-llvmflang-trunk-20240608/bin/flang-new+0x3bd0daa) #16 0x00000000038a19d5 Fortran::frontend::FrontendAction::beginSourceFile(Fortran::frontend::CompilerInstance&, Fortran::frontend::FrontendInputFile const&) (/opt/compiler-explorer/clang-llvmflang-trunk-20240608/bin/flang-new+0x38a19d5) #17 0x0000000003891337 Fortran::frontend::CompilerInstance::executeAction(Fortran::frontend::FrontendAction&) (/opt/compiler-explorer/clang-llvmflang-trunk-20240608/bin/flang-new+0x3891337) #18 0x00000000038a7a1d Fortran::frontend::executeCompilerInvocation(Fortran::frontend::CompilerInstance*) (/opt/compiler-explorer/clang-llvmflang-trunk-20240608/bin/flang-new+0x38a7a1d) #19 0x0000000001fdd798 fc1_main(llvm::ArrayRef<char const*>, char const*) (/opt/compiler-explorer/clang-llvmflang-trunk-20240608/bin/flang-new+0x1fdd798) #20 0x0000000001ec5b54 main (/opt/compiler-explorer/clang-llvmflang-trunk-20240608/bin/flang-new+0x1ec5b54) #21 0x00007d2049a29d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90) #22 0x00007d2049a29e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40) #23 0x0000000001fdc6fe _start (/opt/compiler-explorer/clang-llvmflang-trunk-20240608/bin/flang-new+0x1fdc6fe) 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 435dd9746107e13c2ad019be3bd34815f7d2360d) Target: x86_64-unknown-linux-gnu Thread model: posix InstalledDir: /opt/compiler-explorer/clang-llvmflang-trunk-20240608/bin ```
llvmbot commented 1 month ago

@llvm/issue-subscribers-flang-ir

Author: None (k-arrows)

Reproducible on Godbolt: https://godbolt.org/z/38qrv9jxc Reproducer: ```console module m interface module subroutine s end end interface end submodule (m) sm procedure(s), pointer :: p contains module procedure s end end ``` Stack dump: ```console 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-20240608/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-20240608/bin/.. -mframe-pointer=all -o /app/output.s -x f95-cpp-input /app/example.f90 #0 0x0000000003850c68 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-llvmflang-trunk-20240608/bin/flang-new+0x3850c68) #1 0x000000000384e5dc SignalHandler(int) Signals.cpp:0:0 #2 0x00007d2049a42520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520) #3 0x00007d2049a969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc) #4 0x00007d2049a42476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476) #5 0x00007d2049a287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3) #6 0x0000000001e8f6d2 Fortran::lower::getOrDeclareFunction(Fortran::evaluate::ProcedureDesignator const&, Fortran::lower::AbstractConverter&) (.cold) CallInterface.cpp:0:0 #7 0x0000000003e96c10 (anonymous namespace)::TypeBuilderImpl::genSymbolType(Fortran::semantics::Symbol const&, bool, bool) ConvertType.cpp:0:0 #8 0x0000000003e97b26 Fortran::lower::translateVariableToFIRType(Fortran::lower::AbstractConverter&, Fortran::lower::pft::Variable const&) (/opt/compiler-explorer/clang-llvmflang-trunk-20240608/bin/flang-new+0x3e97b26) #9 0x0000000003eaeae1 defineGlobal(Fortran::lower::AbstractConverter&, Fortran::lower::pft::Variable const&, llvm::StringRef, mlir::StringAttr, cuf::DataAttributeAttr) ConvertVariable.cpp:0:0 #10 0x0000000003eaf88a Fortran::lower::defineModuleVariable(Fortran::lower::AbstractConverter&, Fortran::lower::pft::Variable const&) (/opt/compiler-explorer/clang-llvmflang-trunk-20240608/bin/flang-new+0x3eaf88a) #11 0x0000000003c2d8fb std::_Function_handler<void (), (anonymous namespace)::FirConverter::lowerModuleDeclScope(Fortran::lower::pft::ModuleLikeUnit&)::'lambda'()>::_M_invoke(std::_Any_data const&) Bridge.cpp:0:0 #12 0x0000000003c2c3f6 (anonymous namespace)::FirConverter::createGlobalOutsideOfFunctionLowering(std::function<void ()> const&) Bridge.cpp:0:0 #13 0x0000000003c2c8b0 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 #14 0x0000000003c3ed55 Fortran::lower::LoweringBridge::lower(Fortran::parser::Program const&, Fortran::semantics::SemanticsContext const&) (/opt/compiler-explorer/clang-llvmflang-trunk-20240608/bin/flang-new+0x3c3ed55) #15 0x0000000003bd0daa Fortran::frontend::CodeGenAction::beginSourceFileAction() (/opt/compiler-explorer/clang-llvmflang-trunk-20240608/bin/flang-new+0x3bd0daa) #16 0x00000000038a19d5 Fortran::frontend::FrontendAction::beginSourceFile(Fortran::frontend::CompilerInstance&, Fortran::frontend::FrontendInputFile const&) (/opt/compiler-explorer/clang-llvmflang-trunk-20240608/bin/flang-new+0x38a19d5) #17 0x0000000003891337 Fortran::frontend::CompilerInstance::executeAction(Fortran::frontend::FrontendAction&) (/opt/compiler-explorer/clang-llvmflang-trunk-20240608/bin/flang-new+0x3891337) #18 0x00000000038a7a1d Fortran::frontend::executeCompilerInvocation(Fortran::frontend::CompilerInstance*) (/opt/compiler-explorer/clang-llvmflang-trunk-20240608/bin/flang-new+0x38a7a1d) #19 0x0000000001fdd798 fc1_main(llvm::ArrayRef<char const*>, char const*) (/opt/compiler-explorer/clang-llvmflang-trunk-20240608/bin/flang-new+0x1fdd798) #20 0x0000000001ec5b54 main (/opt/compiler-explorer/clang-llvmflang-trunk-20240608/bin/flang-new+0x1ec5b54) #21 0x00007d2049a29d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90) #22 0x00007d2049a29e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40) #23 0x0000000001fdc6fe _start (/opt/compiler-explorer/clang-llvmflang-trunk-20240608/bin/flang-new+0x1fdc6fe) 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 435dd9746107e13c2ad019be3bd34815f7d2360d) Target: x86_64-unknown-linux-gnu Thread model: posix InstalledDir: /opt/compiler-explorer/clang-llvmflang-trunk-20240608/bin ```
llvmbot commented 1 month ago

@llvm/issue-subscribers-bug

Author: None (k-arrows)

Reproducible on Godbolt: https://godbolt.org/z/38qrv9jxc Reproducer: ```f90 module m interface module subroutine s end end interface end submodule (m) sm procedure(s), pointer :: p contains module procedure s end end ``` Stack dump: ```console 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-20240608/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-20240608/bin/.. -mframe-pointer=all -o /app/output.s -x f95-cpp-input /app/example.f90 #0 0x0000000003850c68 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-llvmflang-trunk-20240608/bin/flang-new+0x3850c68) #1 0x000000000384e5dc SignalHandler(int) Signals.cpp:0:0 #2 0x00007d2049a42520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520) #3 0x00007d2049a969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc) #4 0x00007d2049a42476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476) #5 0x00007d2049a287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3) #6 0x0000000001e8f6d2 Fortran::lower::getOrDeclareFunction(Fortran::evaluate::ProcedureDesignator const&, Fortran::lower::AbstractConverter&) (.cold) CallInterface.cpp:0:0 #7 0x0000000003e96c10 (anonymous namespace)::TypeBuilderImpl::genSymbolType(Fortran::semantics::Symbol const&, bool, bool) ConvertType.cpp:0:0 #8 0x0000000003e97b26 Fortran::lower::translateVariableToFIRType(Fortran::lower::AbstractConverter&, Fortran::lower::pft::Variable const&) (/opt/compiler-explorer/clang-llvmflang-trunk-20240608/bin/flang-new+0x3e97b26) #9 0x0000000003eaeae1 defineGlobal(Fortran::lower::AbstractConverter&, Fortran::lower::pft::Variable const&, llvm::StringRef, mlir::StringAttr, cuf::DataAttributeAttr) ConvertVariable.cpp:0:0 #10 0x0000000003eaf88a Fortran::lower::defineModuleVariable(Fortran::lower::AbstractConverter&, Fortran::lower::pft::Variable const&) (/opt/compiler-explorer/clang-llvmflang-trunk-20240608/bin/flang-new+0x3eaf88a) #11 0x0000000003c2d8fb std::_Function_handler<void (), (anonymous namespace)::FirConverter::lowerModuleDeclScope(Fortran::lower::pft::ModuleLikeUnit&)::'lambda'()>::_M_invoke(std::_Any_data const&) Bridge.cpp:0:0 #12 0x0000000003c2c3f6 (anonymous namespace)::FirConverter::createGlobalOutsideOfFunctionLowering(std::function<void ()> const&) Bridge.cpp:0:0 #13 0x0000000003c2c8b0 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 #14 0x0000000003c3ed55 Fortran::lower::LoweringBridge::lower(Fortran::parser::Program const&, Fortran::semantics::SemanticsContext const&) (/opt/compiler-explorer/clang-llvmflang-trunk-20240608/bin/flang-new+0x3c3ed55) #15 0x0000000003bd0daa Fortran::frontend::CodeGenAction::beginSourceFileAction() (/opt/compiler-explorer/clang-llvmflang-trunk-20240608/bin/flang-new+0x3bd0daa) #16 0x00000000038a19d5 Fortran::frontend::FrontendAction::beginSourceFile(Fortran::frontend::CompilerInstance&, Fortran::frontend::FrontendInputFile const&) (/opt/compiler-explorer/clang-llvmflang-trunk-20240608/bin/flang-new+0x38a19d5) #17 0x0000000003891337 Fortran::frontend::CompilerInstance::executeAction(Fortran::frontend::FrontendAction&) (/opt/compiler-explorer/clang-llvmflang-trunk-20240608/bin/flang-new+0x3891337) #18 0x00000000038a7a1d Fortran::frontend::executeCompilerInvocation(Fortran::frontend::CompilerInstance*) (/opt/compiler-explorer/clang-llvmflang-trunk-20240608/bin/flang-new+0x38a7a1d) #19 0x0000000001fdd798 fc1_main(llvm::ArrayRef<char const*>, char const*) (/opt/compiler-explorer/clang-llvmflang-trunk-20240608/bin/flang-new+0x1fdd798) #20 0x0000000001ec5b54 main (/opt/compiler-explorer/clang-llvmflang-trunk-20240608/bin/flang-new+0x1ec5b54) #21 0x00007d2049a29d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90) #22 0x00007d2049a29e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40) #23 0x0000000001fdc6fe _start (/opt/compiler-explorer/clang-llvmflang-trunk-20240608/bin/flang-new+0x1fdc6fe) 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 435dd9746107e13c2ad019be3bd34815f7d2360d) Target: x86_64-unknown-linux-gnu Thread model: posix InstalledDir: /opt/compiler-explorer/clang-llvmflang-trunk-20240608/bin ```