<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/97015>97015</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
[AArch64][SelectionDAG] UNREACHABLE executed at llvm-project/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp:6664!
</td>
</tr>
<tr>
<th>Labels</th>
<td>
new issue
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
k-arrows
</td>
</tr>
</table>
<pre>
Building prima(https://github.com/shivimathur/prima) with flang-new results in a crash. If you are interested in this issue, please follow the steps below to reproduce the crash.
Steps to reproduce:
```console
# git clone --depth 1 https://github.com/shivimathur/prima
# cd prima
# cmake -S . -B build -Wno-dev -DCMAKE_Fortran_COMPILER=flang-new
# cmake --build build --target install
```
Result of the compilation:
```console
[ 1%] Building Fortran object fortran/CMakeFiles/primaf.dir/common/consts.F90.o
[ 3%] Building Fortran object fortran/CMakeFiles/primaf.dir/common/infos.f90.o
[ 4%] Building Fortran object fortran/CMakeFiles/primaf.dir/common/debug.F90.o
[ 6%] Building Fortran object fortran/CMakeFiles/primaf.dir/common/huge.F90.o
[ 7%] Building Fortran object fortran/CMakeFiles/primaf.dir/common/inf.F90.o
[ 9%] Building Fortran object fortran/CMakeFiles/primaf.dir/common/infnan.F90.o
[ 10%] Building Fortran object fortran/CMakeFiles/primaf.dir/common/checkexit.f90.o
[ 12%] Building Fortran object fortran/CMakeFiles/primaf.dir/common/memory.F90.o
[ 14%] Building Fortran object fortran/CMakeFiles/primaf.dir/common/string.f90.o
[ 15%] Building Fortran object fortran/CMakeFiles/primaf.dir/common/linalg.f90.o
[ 17%] Building Fortran object fortran/CMakeFiles/primaf.dir/common/pintrf.f90.o
[ 18%] Building Fortran object fortran/CMakeFiles/primaf.dir/common/evaluate.f90.o
[ 20%] Building Fortran object fortran/CMakeFiles/primaf.dir/common/powalg.f90.o
[ 21%] Building Fortran object fortran/CMakeFiles/primaf.dir/bobyqa/geometry.f90.o
[ 23%] Building Fortran object fortran/CMakeFiles/primaf.dir/common/history.f90.o
[ 25%] Building Fortran object fortran/CMakeFiles/primaf.dir/common/fprint.f90.o
[ 26%] Building Fortran object fortran/CMakeFiles/primaf.dir/common/message.f90.o
[ 28%] Building Fortran object fortran/CMakeFiles/primaf.dir/common/xinbd.f90.o
[ 29%] Building Fortran object fortran/CMakeFiles/primaf.dir/bobyqa/initialize.f90.o
[ 31%] Building Fortran object fortran/CMakeFiles/primaf.dir/common/ratio.f90.o
[ 32%] Building Fortran object fortran/CMakeFiles/primaf.dir/common/redrho.f90.o
[ 34%] Building Fortran object fortran/CMakeFiles/primaf.dir/bobyqa/rescue.f90.o
[ 35%] Building Fortran object fortran/CMakeFiles/primaf.dir/common/shiftbase.f90.o
[ 37%] Building Fortran object fortran/CMakeFiles/primaf.dir/common/univar.f90.o
[ 39%] Building Fortran object fortran/CMakeFiles/primaf.dir/bobyqa/trustregion.f90.o
[ 40%] Building Fortran object fortran/CMakeFiles/primaf.dir/bobyqa/update.f90.o
[ 42%] Building Fortran object fortran/CMakeFiles/primaf.dir/bobyqa/bobyqb.f90.o
[ 43%] Building Fortran object fortran/CMakeFiles/primaf.dir/common/preproc.f90.o
[ 45%] Building Fortran object fortran/CMakeFiles/primaf.dir/bobyqa/bobyqa.f90.o
[ 46%] Building Fortran object fortran/CMakeFiles/primaf.dir/cobyla/geometry.f90.o
[ 48%] Building Fortran object fortran/CMakeFiles/primaf.dir/common/selectx.f90.o
[ 50%] Building Fortran object fortran/CMakeFiles/primaf.dir/cobyla/initialize.f90.o
[ 51%] Building Fortran object fortran/CMakeFiles/primaf.dir/cobyla/trustregion.f90.o
[ 53%] Building Fortran object fortran/CMakeFiles/primaf.dir/cobyla/update.f90.o
[ 54%] Building Fortran object fortran/CMakeFiles/primaf.dir/cobyla/cobylb.f90.o
unimplemented operand
UNREACHABLE executed at /opt/llvm-project/llvm/lib/Target/AArch64/AArch64ISelLowering.cpp:6664!
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0. Program arguments: /opt/llvm/bin/flang-new -fc1 -triple aarch64-unknown-linux-gnu -emit-obj -D PRIMA_INTEGER_KIND=0 -D PRIMA_REAL_PRECISION=64 -D primaf_EXPORTS -I /work/prima/fortran/common -I /work/prima/build/fortran/mod -fcolor-diagnostics -mrelocation-model pic -pic-level 2 -pic-is-pie -target-cpu generic -target-feature +outline-atomics -target-feature +v8a -target-feature +fp-armv8 -target-feature +neon -fversion-loops-for-stride -module-dir mod -resource-dir /opt/llvm/lib/clang/19 -mframe-pointer=non-leaf -mmlir -fdynamic-heap-array -O3 -o CMakeFiles/primaf.dir/cobyla/cobylb.f90.o -x f95-cpp-input /work/prima/fortran/cobyla/cobylb.f90
1. Running pass 'Function Pass Manager' on module 'FIRModule'.
2. Running pass 'AArch64 Instruction Selection' on function '@_QMcobylb_modPcobylb'
#0 0x0000ffff8cf55184 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/llvm/lib/libLLVMSupport.so.19.0git+0x185184)
#1 0x0000ffff8cf5302c llvm::sys::RunSignalHandlers() (/opt/llvm/lib/libLLVMSupport.so.19.0git+0x18302c)
#2 0x0000ffff8cf558a0 SignalHandler(int) Signals.cpp:0:0
#3 0x0000ffff8e933770 (linux-vdso.so.1+0x770)
#4 0x0000ffff8c927628 (/usr/lib/aarch64-linux-gnu/libc.so.6+0x87628)
#5 0x0000ffff8c8dcb3c raise (/usr/lib/aarch64-linux-gnu/libc.so.6+0x3cb3c)
#6 0x0000ffff8c8c7e00 abort (/usr/lib/aarch64-linux-gnu/libc.so.6+0x27e00)
#7 0x0000ffff8cea3c8c llvm::install_out_of_memory_new_handler() (/opt/llvm/lib/libLLVMSupport.so.19.0git+0xd3c8c)
#8 0x0000ffff8e5cfc88 llvm::AArch64TargetLowering::LowerOperation(llvm::SDValue, llvm::SelectionDAG&) const (/opt/llvm/lib/libLLVMAArch64CodeGen.so.19.0git+0x20fc88)
#9 0x0000ffff8c26bb0c (anonymous namespace)::SelectionDAGLegalize::LegalizeOp(llvm::SDNode*) LegalizeDAG.cpp:0:0
#10 0x0000ffff8c26af84 llvm::SelectionDAG::Legalize() (/opt/llvm/lib/libLLVMSelectionDAG.so.19.0git+0x10af84)
#11 0x0000ffff8c3f5ef0 llvm::SelectionDAGISel::CodeGenAndEmitDAG() (/opt/llvm/lib/libLLVMSelectionDAG.so.19.0git+0x295ef0)
#12 0x0000ffff8c3f3f44 llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) (/opt/llvm/lib/libLLVMSelectionDAG.so.19.0git+0x293f44)
#13 0x0000ffff8c3f16c4 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) (/opt/llvm/lib/libLLVMSelectionDAG.so.19.0git+0x2916c4)
#14 0x0000ffff8c3ef0c4 llvm::SelectionDAGISelLegacy::runOnMachineFunction(llvm::MachineFunction&) (/opt/llvm/lib/libLLVMSelectionDAG.so.19.0git+0x28f0c4)
#15 0x0000ffff8b822574 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (/opt/llvm/lib/libLLVMCodeGen.so.19.0git+0x352574)
#16 0x0000ffff8a214778 llvm::FPPassManager::runOnFunction(llvm::Function&) (/opt/llvm/lib/libLLVMCore.so.19.0git+0x294778)
#17 0x0000ffff8a21c288 llvm::FPPassManager::runOnModule(llvm::Module&) (/opt/llvm/lib/libLLVMCore.so.19.0git+0x29c288)
#18 0x0000ffff8a215144 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/opt/llvm/lib/libLLVMCore.so.19.0git+0x295144)
#19 0x0000ffff8dc267ac Fortran::frontend::CodeGenAction::executeAction() (/opt/llvm/lib/libflangFrontend.so.19.0git+0x667ac)
#20 0x0000ffff8dc19bf4 Fortran::frontend::FrontendAction::execute() (/opt/llvm/lib/libflangFrontend.so.19.0git+0x59bf4)
#21 0x0000ffff8dc05b64 Fortran::frontend::CompilerInstance::executeAction(Fortran::frontend::FrontendAction&) (/opt/llvm/lib/libflangFrontend.so.19.0git+0x45b64)
#22 0x0000ffff8e1c356c Fortran::frontend::executeCompilerInvocation(Fortran::frontend::CompilerInstance*) (/opt/llvm/lib/libflangFrontendTool.so.19.0git+0x356c)
#23 0x0000aaaab44643d8 fc1_main(llvm::ArrayRef<char const*>, char const*) (/opt/llvm/bin/flang-new+0x43d8)
#24 0x0000aaaab4463460 main (/opt/llvm/bin/flang-new+0x3460)
#25 0x0000ffff8c8c84c4 (/usr/lib/aarch64-linux-gnu/libc.so.6+0x284c4)
#26 0x0000ffff8c8c8598 __libc_start_main (/usr/lib/aarch64-linux-gnu/libc.so.6+0x28598)
#27 0x0000aaaab44627f0 _start (/opt/llvm/bin/flang-new+0x27f0)
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 52216349b6faf41351f4bd370439031c416b8f9b)
Target: aarch64-unknown-linux-gnu
Thread model: posix
InstalledDir: /opt/llvm/bin
Build config: +assertions
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzEWt1yqzgSfhpyo8IFAmy4yIUTx2dSk5yTTc7O7p1LiMbWBCRWEvnZp9-SwI4FTnJ-qNqpmSmQRH9ft7pb6o6JUmzLAc695MJLVmek1Tshzx99IqV4Vme5KF7PL1pWFYxvUSNZTTyc7rRulBctPbz28HrL9K7NZ1TUHl6rHXtiNdG7Vnp43X-QoWemd6isCN_6HJ6RBNVWWiHGEUFUErWboesSvYoWEQmIcQ0SlIbCrNA7phBTqgUPX6KmAqIAlaKqxDPSO0BKQ6NQDvZdIAmNFEVLwU52wr1g5QXL7v8PdvnxQqNJt2AedP9SwZWooB_FEdoyjWglOCDfL6DROxSin7TCQRYt0HCkJo-A_Ac0Q_4Fyo25kf8vLvwCnpC_urxd_nm1WQupJeGby2-3d9c3V_detDoYdCTK74T0onxN5BY0YlxpUlUDZY-Nc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