Description
flang crashes with -g on the following example.
module m1
type t1
type(t2),pointer :: x1
end type
type t2
type(t3),pointer :: x2
end type
type t3
type(t1),pointer :: x3
end type
end
program test
use m1
type(t1),pointer :: foo
allocate(foo)
allocate(foo%x1)
allocate(foo%x1%x2)
allocate(foo%x1%x2%x3)
call sub1(foo%x1)
print *,'done'
end program
subroutine sub1(bar)
use m1
type(t2) :: bar
end subroutine
$ flang -g bug.f90
flang: /proj/build/llvm/Linux_x86_64/mlir/lib/Target/LLVMIR/DebugTranslation.cpp:276: llvm::DINode* mlir::LLVM::detail::DebugTranslation::translateRecursive(mlir::LLVM::DIRecursiveTypeAttrInterface): Assertion `!attr.getIsRecSelf() && "u
nbound DI recursive self reference"' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0. Program arguments: /proj/nv/llvm/Linux_x86_64/llvm-4092/bin/flang -fc1 -triple x86_64-unknown-linux-gnu -emit-obj -fcolor-diagnostics -mrelocation-model pic -pic-level 2 -pic-is-pie -target-cpu x86-64 -debug-info-kind=standalone -resource-dir /proj/nv/llvm/Linux_x86_64/llvm-4092/lib/clang/20 -mframe-pointer=all -o /tmp/bug-112a39.o -x f95-cpp-input bug.f90
#0 0x000055b5c315fa8b llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/proj/nv/llvm/Linux_x86_64/llvm-4092/bin/flang+0x447ba8b)
#1 0x000055b5c315d2c4 SignalHandler(int) Signals.cpp:0:0
#2 0x00007fec3c83c4b0 (/lib/x86_64-linux-gnu/libc.so.6+0x3c4b0)
#3 0x00007fec3c890ffb __pthread_kill_implementation ./nptl/pthread_kill.c:44:76
#4 0x00007fec3c890ffb __pthread_kill_internal ./nptl/pthread_kill.c:78:10
#5 0x00007fec3c890ffb pthread_kill ./nptl/pthread_kill.c:89:10
#6 0x00007fec3c83c406 raise ./signal/../sysdeps/posix/raise.c:27:6
#7 0x00007fec3c82287c abort ./stdlib/abort.c:81:7
#8 0x00007fec3c82279b _nl_load_domain ./intl/loadmsgcat.c:1177:9
#9 0x00007fec3c833b86 (/lib/x86_64-linux-gnu/libc.so.6+0x33b86)
#10 0x000055b5c5f2b289 mlir::LLVM::detail::DebugTranslation::translateRecursive(mlir::LLVM::DIRecursiveTypeAttrInterface) (/proj/nv/llvm/Linux_x86_64/llvm-4092/bin/flang+0x7247289)
#11 0x000055b5c5f27952 mlir::LLVM::detail::DebugTranslation::translate(mlir::LLVM::DINodeAttr) (/proj/nv/llvm/Linux_x86_64/llvm-4092/bin/flang+0x7243952)
#12 0x000055b5c5f28c14 mlir::LLVM::detail::DebugTranslation::translateImpl(mlir::LLVM::DIDerivedTypeAttr) (/proj/nv/llvm/Linux_x86_64/llvm-4092/bin/flang+0x7244c14)
#13 0x000055b5c5f27c7b mlir::LLVM::detail::DebugTranslation::translate(mlir::LLVM::DINodeAttr) (/proj/nv/llvm/Linux_x86_64/llvm-4092/bin/flang+0x7243c7b)
#14 0x000055b5c5f28c14 mlir::LLVM::detail::DebugTranslation::translateImpl(mlir::LLVM::DIDerivedTypeAttr) (/proj/nv/llvm/Linux_x86_64/llvm-4092/bin/flang+0x7244c14)
#15 0x000055b5c5f27c7b mlir::LLVM::detail::DebugTranslation::translate(mlir::LLVM::DINodeAttr) (/proj/nv/llvm/Linux_x86_64/llvm-4092/bin/flang+0x7243c7b)
#16 0x000055b5c5f29dd0 mlir::LLVM::detail::DebugTranslation::getMDTupleOrNull(llvm::ArrayRef<mlir::LLVM::DINodeAttr>) (/proj/nv/llvm/Linux_x86_64/llvm-4092/bin/flang+0x7245dd0)
#17 0x000055b5c5f2abab mlir::LLVM::detail::DebugTranslation::translateImpl(mlir::LLVM::DICompositeTypeAttr) (/proj/nv/llvm/Linux_x86_64/llvm-4092/bin/flang+0x7246bab)
#18 0x000055b5c5f2af9f mlir::LLVM::detail::DebugTranslation::translateRecursive(mlir::LLVM::DIRecursiveTypeAttrInterface) (/proj/nv/llvm/Linux_x86_64/llvm-4092/bin/flang+0x7246f9f)
#19 0x000055b5c5f27952 mlir::LLVM::detail::DebugTranslation::translate(mlir::LLVM::DINodeAttr) (/proj/nv/llvm/Linux_x86_64/llvm-4092/bin/flang+0x7243952)
#20 0x000055b5c5f28c14 mlir::LLVM::detail::DebugTranslation::translateImpl(mlir::LLVM::DIDerivedTypeAttr) (/proj/nv/llvm/Linux_x86_64/llvm-4092/bin/flang+0x7244c14)
#21 0x000055b5c5f27c7b mlir::LLVM::detail::DebugTranslation::translate(mlir::LLVM::DINodeAttr) (/proj/nv/llvm/Linux_x86_64/llvm-4092/bin/flang+0x7243c7b)
#22 0x000055b5c5f28c14 mlir::LLVM::detail::DebugTranslation::translateImpl(mlir::LLVM::DIDerivedTypeAttr) (/proj/nv/llvm/Linux_x86_64/llvm-4092/bin/flang+0x7244c14)
#23 0x000055b5c5f27c7b mlir::LLVM::detail::DebugTranslation::translate(mlir::LLVM::DINodeAttr) (/proj/nv/llvm/Linux_x86_64/llvm-4092/bin/flang+0x7243c7b)
#24 0x000055b5c5f29dd0 mlir::LLVM::detail::DebugTranslation::getMDTupleOrNull(llvm::ArrayRef<mlir::LLVM::DINodeAttr>) (/proj/nv/llvm/Linux_x86_64/llvm-4092/bin/flang+0x7245dd0)
#25 0x000055b5c5f2abab mlir::LLVM::detail::DebugTranslation::translateImpl(mlir::LLVM::DICompositeTypeAttr) (/proj/nv/llvm/Linux_x86_64/llvm-4092/bin/flang+0x7246bab)
#26 0x000055b5c5f2af9f mlir::LLVM::detail::DebugTranslation::translateRecursive(mlir::LLVM::DIRecursiveTypeAttrInterface) (/proj/nv/llvm/Linux_x86_64/llvm-4092/bin/flang+0x7246f9f)
#27 0x000055b5c5f27952 mlir::LLVM::detail::DebugTranslation::translate(mlir::LLVM::DINodeAttr) (/proj/nv/llvm/Linux_x86_64/llvm-4092/bin/flang+0x7243952)
#28 0x000055b5c5f28a2b mlir::LLVM::detail::DebugTranslation::translateImpl(mlir::LLVM::DISubroutineTypeAttr) (/proj/nv/llvm/Linux_x86_64/llvm-4092/bin/flang+0x7244a2b)
#29 0x000055b5c5f27e63 mlir::LLVM::detail::DebugTranslation::translate(mlir::LLVM::DINodeAttr) (/proj/nv/llvm/Linux_x86_64/llvm-4092/bin/flang+0x7243e63)
#30 0x000055b5c5f2a0e6 mlir::LLVM::detail::DebugTranslation::translateImpl(mlir::LLVM::DISubprogramAttr) (/proj/nv/llvm/Linux_x86_64/llvm-4092/bin/flang+0x72460e6)
#31 0x000055b5c5f2b05f mlir::LLVM::detail::DebugTranslation::translateRecursive(mlir::LLVM::DIRecursiveTypeAttrInterface) (/proj/nv/llvm/Linux_x86_64/llvm-4092/bin/flang+0x724705f)
#32 0x000055b5c5f27952 mlir::LLVM::detail::DebugTranslation::translate(mlir::LLVM::DINodeAttr) (/proj/nv/llvm/Linux_x86_64/llvm-4092/bin/flang+0x7243952)
#33 0x000055b5c5f2b342 mlir::LLVM::detail::DebugTranslation::translate(mlir::LLVM::LLVMFuncOp, llvm::Function&) (/proj/nv/llvm/Linux_x86_64/llvm-4092/bin/flang+0x7247342)
#34 0x000055b5c5f1e1c6 mlir::LLVM::ModuleTranslation::convertFunctionSignatures() (/proj/nv/llvm/Linux_x86_64/llvm-4092/bin/flang+0x723a1c6)
#35 0x000055b5c5f253c4 mlir::translateModuleToLLVMIR(mlir::Operation*, llvm::LLVMContext&, llvm::StringRef, bool) (/proj/nv/llvm/Linux_x86_64/llvm-4092/bin/flang+0x72413c4)
#36 0x000055b5c32d06ba Fortran::frontend::CodeGenAction::generateLLVMIR() (/proj/nv/llvm/Linux_x86_64/llvm-4092/bin/flang+0x45ec6ba)
#37 0x000055b5c32d3be0 Fortran::frontend::CodeGenAction::executeAction() (/proj/nv/llvm/Linux_x86_64/llvm-4092/bin/flang+0x45efbe0)
#38 0x000055b5c31a5f3d Fortran::frontend::FrontendAction::execute() (/proj/nv/llvm/Linux_x86_64/llvm-4092/bin/flang+0x44c1f3d)
#39 0x000055b5c3185c9b Fortran::frontend::CompilerInstance::executeAction(Fortran::frontend::FrontendAction&) (/proj/nv/llvm/Linux_x86_64/llvm-4092/bin/flang+0x44a1c9b)
#40 0x000055b5c31ad54e Fortran::frontend::executeCompilerInvocation(Fortran::frontend::CompilerInstance*) (/proj/nv/llvm/Linux_x86_64/llvm-4092/bin/flang+0x44c954e)
#41 0x000055b5c2a868cd fc1_main(llvm::ArrayRef<char const*>, char const*) (/proj/nv/llvm/Linux_x86_64/llvm-4092/bin/flang+0x3da28cd)
#42 0x000055b5c2a86279 main (/proj/nv/llvm/Linux_x86_64/llvm-4092/bin/flang+0x3da2279)
#43 0x00007fec3c823a90 __libc_start_call_main ./csu/../sysdeps/nptl/libc_start_call_main.h:74:3
#44 0x00007fec3c823b49 call_init ./csu/../csu/libc-start.c:128:20
#45 0x00007fec3c823b49 __libc_start_main ./csu/../csu/libc-start.c:347:5
#46 0x000055b5c2a846ee _start (/proj/nv/llvm/Linux_x86_64/llvm-4092/bin/flang+0x3da06ee)
flang-20: error: unable to execute command: Aborted (core dumped)
flang-20: error: flang frontend command failed due to signal (use -v to see invocation)
flang version 20.0.0git (https://github.com/llvm/llvm-project 4c4364869c490600b4e33606d481fb27b438d090)