flang-compiler / f18-llvm-project

Fork of llvm/llvm-project for f18. In sync with f18-mlir and f18.
http://llvm.org
28 stars 16 forks source link

not yet implemented default initialization of global variables #945

Closed oroppas closed 3 years ago

oroppas commented 3 years ago

The following code snippet crashed bbc

module qm2_dftb_module

   type cm3_structure
      integer :: num_params = 15
   end type cm3_structure

   type (cm3_structure), target, save :: cm3

end module qm2_dftb_module

and stack dump

bbc default_init_global_variables.f90 
error: loc("./default_init_global_variables.f90":7:42): /home/ryuta/packages/llvm/flang/f18-llvm-project/flang/lib/Lower/ConvertVariable.cpp:319: not yet implemented default initialization of global variables
LLVM ERROR: aborting
PLEASE submit a bug report to https://bugs.llvm.org/ and include the crash backtrace.
Stack dump:
0.  Program arguments: /home/ryuta/packages/llvm/flang/build/bin/bbc default_init_global_variables.f90
 #0 0x00007facf57fe653 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/ryuta/packages/llvm/flang/build/lib/libLLVMSupport.so.13git+0x225653)
 #1 0x00007facf57fbfee llvm::sys::RunSignalHandlers() (/home/ryuta/packages/llvm/flang/build/lib/libLLVMSupport.so.13git+0x222fee)
 #2 0x00007facf57fecdf SignalHandler(int) Signals.cpp:0:0
 #3 0x00007facf98d8630 __restore_rt sigaction.c:0:0
 #4 0x00007facf4e0d387 raise (/lib64/libc.so.6+0x36387)
 #5 0x00007facf4e0ea78 abort (/lib64/libc.so.6+0x37a78)
 #6 0x00007facf571ebd3 llvm::report_fatal_error(llvm::Twine const&, bool) (/home/ryuta/packages/llvm/flang/build/lib/libLLVMSupport.so.13git+0x145bd3)
 #7 0x00007facf571ea36 (/home/ryuta/packages/llvm/flang/build/lib/libLLVMSupport.so.13git+0x145a36)
 #8 0x00007facf9583132 (/home/ryuta/packages/llvm/flang/build/lib/libFortranLower.so.13git+0x1fd132)
 #9 0x00007facf97bd114 defineGlobal(Fortran::lower::AbstractConverter&, Fortran::lower::pft::Variable const&, llvm::StringRef, mlir::StringAttr) ConvertVariable.cpp:0:0
#10 0x00007facf97bbc39 Fortran::lower::defineModuleVariable(Fortran::lower::AbstractConverter&, Fortran::lower::pft::Variable const&) (/home/ryuta/packages/llvm/flang/build/lib/libFortranLower.so.13git+0x435c39)
#11 0x00007facf95bfb4b decltype(auto) std::__1::__variant_detail::__visitation::__base::__dispatcher<1ul>::__dispatch<std::__1::__variant_detail::__visitation::__variant::__value_visitor<Fortran::common::visitors<(anonymous namespace)::FirConverter::lowerModuleVariables(Fortran::lower::pft::Program&)::'lambda'(Fortran::lower::pft::ModuleLikeUnit&), (anonymous namespace)::FirConverter::lowerModuleVariables(Fortran::lower::pft::Program&)::'lambda'(auto&)> >&&, std::__1::__variant_detail::__base<(std::__1::__variant_detail::_Trait)1, Fortran::lower::pft::FunctionLikeUnit, Fortran::lower::pft::ModuleLikeUnit, Fortran::lower::pft::BlockDataUnit, Fortran::lower::pft::CompilerDirectiveUnit>&>(auto, std::__1::__variant_detail::__base<(std::__1::__variant_detail::_Trait)1, Fortran::lower::pft::FunctionLikeUnit, Fortran::lower::pft::ModuleLikeUnit, Fortran::lower::pft::BlockDataUnit, Fortran::lower::pft::CompilerDirectiveUnit>&) Bridge.cpp:0:0
#12 0x00007facf95ba5e5 Fortran::lower::LoweringBridge::lower(Fortran::parser::Program const&, Fortran::semantics::SemanticsContext const&) (/home/ryuta/packages/llvm/flang/build/lib/libFortranLower.so.13git+0x2345e5)
oroppas commented 3 years ago

Fixed by #963. Thanks!