Issue |
137126
|
Summary |
[flang] Flang is unable to lower to LLVM IR
|
Labels |
flang
|
Assignees |
|
Reporter |
inaki-amatria
|
- `flang` version is: `flang version 21.0.0git (g...@github.com:inaki-amatria/llvm-project.git 054ee17f88fcd4dd8d646740b975ef1d2f4ea3aa)`
- Reduced test case:
```fortran
! foo.f90
program main
use external_types
contains
subroutine foo()
type(external_data_t) :: foo_list
end
subroutine bar(bar_patch)
type(patch_t) :: bar_patch
end
end
! bar.f90
module model
type :: subset_range_t
type(patch_t), pointer :: p => null()
end type
type :: grid_vertices_t
type(subset_range_t) :: domain
end type
type :: patch_t
type(grid_vertices_t) :: verts
end type
end
module var_metadata
use model
type :: var_metadata_t
type(subset_range_t) :: access
end type
end
module var
use var_metadata
type :: var_t
type(var_metadata_t) :: md
end type
type :: var_ptr_t
type(var_t), pointer :: p => null()
end type
end
module var_list
use var
type :: var_list_t
type(var_ptr_t) :: var
end type
type :: var_list_ptr_t
type(var_list_t), pointer :: p => null()
end type
end
module external_types
use var_list
type :: external_data_t
type(var_list_ptr_t) :: list
end type
end
```
- `flang` invocation is: `flang -fc1 -emit-llvm bar.f90 foo.f90`
- Expected behavior is: The code lowers to LLVM IR successfully
- Actual behavior: Lowering aborts with the following backtrace:
```
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0. Program arguments: /home/inaki/repos/llvm-project/build/bin/flang -fc1 -emit-llvm bar.f90 foo.f90
#0 0x00006517c534a6b6 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/home/inaki/repos/llvm-project/build/bin/flang+0x27656b6)
#1 0x00006517c534818e llvm::sys::RunSignalHandlers() (/home/inaki/repos/llvm-project/build/bin/flang+0x276318e)
#2 0x00006517c534b014 SignalHandler(int, siginfo_t*, void*) Signals.cpp:0:0
#3 0x000077fd16c4bcd0 (/usr/lib/libc.so.6+0x3dcd0)
#4 0x00006517ca44bb78 mlir::Operation::~Operation() (/home/inaki/repos/llvm-project/build/bin/flang+0x7866b78)
#5 0x00006517ca44c58d llvm::ilist_traits<mlir::Operation>::deleteNode(mlir::Operation*) (/home/inaki/repos/llvm-project/build/bin/flang+0x786758d)
#6 0x00006517ca39e457 mlir::Block::clear() Block.cpp:0:0
#7 0x00006517ca39e32d mlir::Block::~Block() (/home/inaki/repos/llvm-project/build/bin/flang+0x77b932d)
#8 0x00006517ca45fde3 mlir::Region::~Region() (/home/inaki/repos/llvm-project/build/bin/flang+0x787ade3)
#9 0x00006517ca44bb48 mlir::Operation::~Operation() (/home/inaki/repos/llvm-project/build/bin/flang+0x7866b48)
#10 0x00006517ca44c58d llvm::ilist_traits<mlir::Operation>::deleteNode(mlir::Operation*) (/home/inaki/repos/llvm-project/build/bin/flang+0x786758d)
#11 0x00006517ca39e457 mlir::Block::clear() Block.cpp:0:0
#12 0x00006517ca39e32d mlir::Block::~Block() (/home/inaki/repos/llvm-project/build/bin/flang+0x77b932d)
#13 0x00006517ca45fde3 mlir::Region::~Region() (/home/inaki/repos/llvm-project/build/bin/flang+0x787ade3)
#14 0x00006517ca44bb48 mlir::Operation::~Operation() (/home/inaki/repos/llvm-project/build/bin/flang+0x7866b48)
#15 0x00006517ca44c6a0 mlir::Operation::erase() (/home/inaki/repos/llvm-project/build/bin/flang+0x78676a0)
#16 0x00006517c5388543 Fortran::frontend::CodeGenAction::beginSourceFileAction() (/home/inaki/repos/llvm-project/build/bin/flang+0x27a3543)
#17 0x00006517c538366f Fortran::frontend::FrontendAction::beginSourceFile(Fortran::frontend::CompilerInstance&, Fortran::frontend::FrontendInputFile const&) (/home/inaki/repos/llvm-project/build/bin/flang+0x279e66f)
#18 0x00006517c5363203 Fortran::frontend::CompilerInstance::executeAction(Fortran::frontend::FrontendAction&) (/home/inaki/repos/llvm-project/build/bin/flang+0x277e203)
#19 0x00006517c53879cd Fortran::frontend::executeCompilerInvocation(Fortran::frontend::CompilerInstance*) (/home/inaki/repos/llvm-project/build/bin/flang+0x27a29cd)
#20 0x00006517c4ea70d4 fc1_main(llvm::ArrayRef<char const*>, char const*) (/home/inaki/repos/llvm-project/build/bin/flang+0x22c20d4)
#21 0x00006517c4ea62f6 main (/home/inaki/repos/llvm-project/build/bin/flang+0x22c12f6)
#22 0x000077fd16c35488 (/usr/lib/libc.so.6+0x27488)
#23 0x000077fd16c3554c __libc_start_main (/usr/lib/libc.so.6+0x2754c)
#24 0x00006517c4ea53a5 _start (/home/inaki/repos/llvm-project/build/bin/flang+0x22c03a5)
Segmentation fault (core dumped)
```
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs