Closed
Description
This is an issue from Fujitsu testsuite.
Flang-new terminates abnormally when compiling a internal subroutine subprogram that use variables defined in the host program.
This issue isn't reproduced when the target is X86.
The following are the test program, Flang-new and gfortran compilation result.
! test.f90
integer i
call sub(inn)
contains
subroutine inn
i = 1
end subroutine inn
end
$ flang-new -v test.f90 -c
flang-new version 18.0.0 (https://github.com/llvm/llvm-project.git 701e6f7630474b637e0bc45d009bf2ec47f2d3fd)
Target: aarch64-unknown-linux-gnu
Thread model: posix
InstalledDir: /path/to/install/bin
Found candidate GCC installation: /usr/lib/gcc/aarch64-redhat-linux/8
Selected GCC installation: /usr/lib/gcc/aarch64-redhat-linux/8
Candidate multilib: .;@m64
Selected multilib: .;@m64
"/path/to/install/bin/flang-new" -fc1 -triple aarch64-unknown-linux-gnu -emit-obj -fcolor-diagnostics -mrelocation-model pic -pic-level 2 -pic-is-pie -target-cpu generic -target-feature +neon -target-feature +v8a -o test.o -x f95-cpp-input test.f90
unimplemented operand
UNREACHABLE executed at /path/to/llvm-project/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp:5872!
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0. Program arguments: /path/to/install/bin/flang-new -fc1 -triple aarch64-unknown-linux-gnu -emit-obj -fcolor-diagnostics -mrelocation-model pic -pic-level 2 -pic-is-pie -target-cpu generic -target-feature +neon -target-feature +v8a -o test.o -x f95-cpp-input test.f90
1. Running pass 'Function Pass Manager' on module 'FIRModule'.
2. Running pass 'AArch64 Instruction Selection' on function '@_QQmain'
#0 0x0000ffff81ee5f60 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/path/to/install/bin/../lib/libLLVMSupport.so.18git+0x1a5f60)
#1 0x0000ffff81ee3b40 llvm::sys::RunSignalHandlers() (/path/to/install/bin/../lib/libLLVMSupport.so.18git+0x1a3b40)
#2 0x0000ffff81ee3cb0 SignalHandler(int) Signals.cpp:0:0
#3 0x0000ffff839c066c (linux-vdso.so.1+0x66c)
#4 0x0000ffff818c2dbc raise (/lib64/libc.so.6+0x32dbc)
#5 0x0000ffff818b0928 abort (/lib64/libc.so.6+0x20928)
#6 0x0000ffff81e1895c (/path/to/install/bin/../lib/libLLVMSupport.so.18git+0xd895c)
#7 0x0000ffff8350ffd0 llvm::AArch64TargetLowering::LowerOperation(llvm::SDValue, llvm::SelectionDAG&) const (/path/to/install/bin/../lib/libLLVMAArch64CodeGen.so.18git+0x26ffd0)
#8 0x0000ffff8123d444 (anonymous namespace)::SelectionDAGLegalize::LegalizeOp(llvm::SDNode*) LegalizeDAG.cpp:0:0
#9 0x0000ffff81248e94 llvm::SelectionDAG::Legalize() (/path/to/install/bin/../lib/../lib/libLLVMSelectionDAG.so.18git+0x148e94)
#10 0x0000ffff813e8ff4 llvm::SelectionDAGISel::CodeGenAndEmitDAG() (/path/to/install/bin/../lib/../lib/libLLVMSelectionDAG.so.18git+0x2e8ff4)
#11 0x0000ffff813ec4dc llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) (/path/to/install/bin/../lib/../lib/libLLVMSelectionDAG.so.18git+0x2ec4dc)
#12 0x0000ffff813ede08 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) (.part.0) SelectionDAGISel.cpp:0:0
#13 0x0000ffff80aae570 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (.part.0) MachineFunctionPass.cpp:0:0
#14 0x0000ffff7f4404a4 llvm::FPPassManager::runOnFunction(llvm::Function&) (/path/to/install/bin/../lib/../lib/libLLVMCore.so.18git+0x2904a4)
#15 0x0000ffff7f4406e0 llvm::FPPassManager::runOnModule(llvm::Module&) (/path/to/install/bin/../lib/../lib/libLLVMCore.so.18git+0x2906e0)
#16 0x0000ffff7f440fe8 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/path/to/install/bin/../lib/../lib/libLLVMCore.so.18git+0x290fe8)
#17 0x0000ffff82bd0c6c Fortran::frontend::CodeGenAction::executeAction() (/path/to/install/bin/../lib/libflangFrontend.so.18git+0x120c6c)
#18 0x0000ffff82b02b2c Fortran::frontend::FrontendAction::execute() (/path/to/install/bin/../lib/libflangFrontend.so.18git+0x52b2c)
#19 0x0000ffff82af43c4 Fortran::frontend::CompilerInstance::executeAction(Fortran::frontend::FrontendAction&) (/path/to/install/bin/../lib/libflangFrontend.so.18git+0x443c4)
#20 0x0000ffff83053bbc Fortran::frontend::executeCompilerInvocation(Fortran::frontend::CompilerInstance*) (/path/to/install/bin/../lib/libflangFrontendTool.so.18git+0x3bbc)
#21 0x00000000004048dc fc1_main(llvm::ArrayRef<char const*>, char const*) (/path/to/install/bin/flang-new+0x4048dc)
#22 0x0000000000403108 main (/path/to/install/bin/flang-new+0x403108)
#23 0x0000ffff818b0d64 __libc_start_main (/lib64/libc.so.6+0x20d64)
#24 0x00000000004035d0 _start (/path/to/install/bin/flang-new+0x4035d0)
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 18.0.0 (https://github.com/llvm/llvm-project.git 701e6f7630474b637e0bc45d009bf2ec47f2d3fd)
Target: aarch64-unknown-linux-gnu
Thread model: posix
InstalledDir: /path/to/install/bin
flang-new: note: diagnostic msg:
********************
PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
flang-new: note: diagnostic msg: /tmp/test-398d2a
flang-new: note: diagnostic msg: /tmp/test-398d2a.sh
flang-new: note: diagnostic msg:
********************
$ gfortran -v test.f90 -c
Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/usr/libexec/gcc/aarch64-redhat-linux/8/lto-wrapper
Target: aarch64-redhat-linux
Configured with: ../configure --enable-bootstrap --enable-languages=c,c++,fortran,lto --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-shared --enable-threads=posix --enable-checking=release --enable-multilib --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --with-gcc-major-version-only --with-linker-hash-style=gnu --enable-plugin --enable-initfini-array --with-isl --disable-libmpx --enable-gnu-indirect-function --build=aarch64-redhat-linux
Thread model: posix
gcc version 8.4.1 20200928 (Red Hat 8.4.1-1) (GCC)
:
$
Metadata
Metadata
Assignees
Type
Projects
Status
Done