<table border="1" cellspacing="0" cellpadding="8">
<tr>
<th>Issue</th>
<td>
<a href=https://github.com/llvm/llvm-project/issues/58169>58169</a>
</td>
</tr>
<tr>
<th>Summary</th>
<td>
Crash in MipsDAGToDAGISel with O3
</td>
</tr>
<tr>
<th>Labels</th>
<td>
backend:MIPS
</td>
</tr>
<tr>
<th>Assignees</th>
<td>
</td>
</tr>
<tr>
<th>Reporter</th>
<td>
vitalybuka
</td>
</tr>
</table>
<pre>
```
FAILED: lib/scudo/standalone/tests/ScudoUnitTestsObjects.gtest-all.cc.mips64.o /b/sanitizer-x86_64-linux-qemu/build/llvm_build2_mips64_qemu/lib/scudo/standalone/tests/ScudoUnitTestsObjects.gtest-all.cc.mips64.o
cd /b/sanitizer-x86_64-linux-qemu/build/llvm_build2_mips64_qemu/lib/scudo/standalone/tests && /b/sanitizer-x86_64-linux-qemu/build/llvm_build2_host/bin/clang -fPIC -Wall -Wno-unused-parameter -Wno-unknown-warning-option --target=mips64-linux-gnuabi64 -Wthread-safety -Wthread-safety-reference -Wthread-safety-beta -O3 -gline-tables-only -g -Wno-covered-switch-default -Wno-suggest-override -DGTEST_NO_LLVM_SUPPORT=1 -DGTEST_HAS_RTTI=0 -I/b/sanitizer-x86_64-linux-qemu/build/llvm-project/llvm/utils/unittest/googletest/include -I/b/sanitizer-x86_64-linux-qemu/build/llvm-project/llvm/utils/unittest/googletest -I/b/sanitizer-x86_64-linux-qemu/build/llvm-project/compiler-rt/include -I/b/sanitizer-x86_64-linux-qemu/build/llvm-project/compiler-rt/lib -I/b/sanitizer-x86_64-linux-qemu/build/llvm-project/compiler-rt/lib/scudo/standalone -I/b/sanitizer-x86_64-linux-qemu/build/llvm-project/compiler-rt/lib/scudo/standalone/include -DGTEST_HAS_RTTI=0 -g -Wno-mismatched-new-delete -c -o ScudoUnitTestsObjects.gtest-all.cc.mips64.o /b/sanitizer-x86_64-linux-qemu/build/llvm-project/llvm/utils/unittest/googletest/src/gtest-all.cc
clang: /b/sanitizer-x86_64-linux-qemu/build/llvm-project/llvm/lib/Target/Mips/MipsISelDAGToDAG.cpp:301: virtual void llvm::MipsDAGToDAGISel::Select(llvm::SDNode *): Assertion `(Subtarget->systemSupportsUnalignedAccess() || cast<MemSDNode>(Node)->getMemoryVT().getSizeInBits() / 8 <= cast<MemSDNode>(Node)->getAlignment()) && "Unexpected unaligned loads/stores."' failed.
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace, preprocessed source, and associated run script.
Stack dump:
0. Program arguments: /b/sanitizer-x86_64-linux-qemu/build/llvm_build2_host/bin/clang -fPIC -Wall -Wno-unused-parameter -Wno-unknown-warning-option --target=mips64-linux-gnuabi64 -Wthread-safety -Wthread-safety-reference -Wthread-safety-beta -O3 -gline-tables-only -g -Wno-covered-switch-default -Wno-suggest-override -DGTEST_NO_LLVM_SUPPORT=1 -DGTEST_HAS_RTTI=0 -I/b/sanitizer-x86_64-linux-qemu/build/llvm-project/llvm/utils/unittest/googletest/include -I/b/sanitizer-x86_64-linux-qemu/build/llvm-project/llvm/utils/unittest/googletest -I/b/sanitizer-x86_64-linux-qemu/build/llvm-project/compiler-rt/include -I/b/sanitizer-x86_64-linux-qemu/build/llvm-project/compiler-rt/lib -I/b/sanitizer-x86_64-linux-qemu/build/llvm-project/compiler-rt/lib/scudo/standalone -I/b/sanitizer-x86_64-linux-qemu/build/llvm-project/compiler-rt/lib/scudo/standalone/include -DGTEST_HAS_RTTI=0 -g -Wno-mismatched-new-delete -c -o ScudoUnitTestsObjects.gtest-all.cc.mips64.o /b/sanitizer-x86_64-linux-qemu/build/llvm-project/llvm/utils/unittest/googletest/src/gtest-all.cc
1. <eof> parser at end of file
2. Code generation
3. Running pass 'Function Pass Manager' on module '/b/sanitizer-x86_64-linux-qemu/build/llvm-project/llvm/utils/unittest/googletest/src/gtest-all.cc'.
4. Running pass 'MIPS DAG->DAG Pattern Instruction Selection' on function '@_ZN7testing8UnitTest17AddTestPartResultENS_14TestPartResult4TypeEPKciRKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEESC_'
#0 0x0000564635985c23 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/b/sanitizer-x86_64-linux-qemu/build/llvm_build2_host/bin/clang+0x7204c23)
#1 0x0000564635983c2e llvm::sys::RunSignalHandlers() (/b/sanitizer-x86_64-linux-qemu/build/llvm_build2_host/bin/clang+0x7202c2e)
#2 0x00005646358ea83f (anonymous namespace)::CrashRecoveryContextImpl::HandleCrash(int, unsigned long) CrashRecoveryContext.cpp:0:0
#3 0x00005646358eaa91 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
#4 0x00007fc8bfe17520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
#5 0x00007fc8bfe6ba7c pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x96a7c)
#6 0x00007fc8bfe17476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
#7 0x00007fc8bfdfd7f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
#8 0x00007fc8bfdfd71b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
#9 0x00007fc8bfe0ee96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
#10 0x00005646340c4bea (/b/sanitizer-x86_64-linux-qemu/build/llvm_build2_host/bin/clang+0x5943bea)
#11 0x0000564636ad0af5 llvm::SelectionDAGISel::DoInstructionSelection() (/b/sanitizer-x86_64-linux-qemu/build/llvm_build2_host/bin/clang+0x834faf5)
#12 0x0000564636acfa51 llvm::SelectionDAGISel::CodeGenAndEmitDAG() (/b/sanitizer-x86_64-linux-qemu/build/llvm_build2_host/bin/clang+0x834ea51)
#13 0x0000564636acd516 llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) (/b/sanitizer-x86_64-linux-qemu/build/llvm_build2_host/bin/clang+0x834c516)
#14 0x0000564636ac9cea llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) (/b/sanitizer-x86_64-linux-qemu/build/llvm_build2_host/bin/clang+0x8348cea)
#15 0x00005646340c3ffa llvm::MipsDAGToDAGISel::runOnMachineFunction(llvm::MachineFunction&) MipsISelDAGToDAG.cpp:0:0
#16 0x0000564634ce52a5 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (/b/sanitizer-x86_64-linux-qemu/build/llvm_build2_host/bin/clang+0x65642a5)
#17 0x00005646351a45d7 llvm::FPPassManager::runOnFunction(llvm::Function&) (/b/sanitizer-x86_64-linux-qemu/build/llvm_build2_host/bin/clang+0x6a235d7)
#18 0x00005646351ac761 llvm::FPPassManager::runOnModule(llvm::Module&) (/b/sanitizer-x86_64-linux-qemu/build/llvm_build2_host/bin/clang+0x6a2b761)
#19 0x00005646351a5075 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/b/sanitizer-x86_64-linux-qemu/build/llvm_build2_host/bin/clang+0x6a24075)
#20 0x0000564636201fad clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::StringRef, llvm::Module*, clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream>>) (/b/sanitizer-x86_64-linux-qemu/build/llvm_build2_host/bin/clang+0x7a80fad)
#21 0x000056463663268e clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) CodeGenAction.cpp:0:0
#22 0x00005646378ab64e clang::ParseAST(clang::Sema&, bool, bool) (/b/sanitizer-x86_64-linux-qemu/build/llvm_build2_host/bin/clang+0x912a64e)
#23 0x0000564636551520 clang::FrontendAction::Execute() (/b/sanitizer-x86_64-linux-qemu/build/llvm_build2_host/bin/clang+0x7dd0520)
#24 0x00005646364c203f clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/b/sanitizer-x86_64-linux-qemu/build/llvm_build2_host/bin/clang+0x7d4103f)
#25 0x000056463662b922 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/b/sanitizer-x86_64-linux-qemu/build/llvm_build2_host/bin/clang+0x7eaa922)
#26 0x00005646335008b5 cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/b/sanitizer-x86_64-linux-qemu/build/llvm_build2_host/bin/clang+0x4d7f8b5)
#27 0x00005646334fe521 ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&) driver.cpp:0:0
#28 0x000056463633cb72 void llvm::function_ref<void ()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const::$_1>(long) Job.cpp:0:0
#29 0x00005646358ea6bc llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/b/sanitizer-x86_64-linux-qemu/build/llvm_build2_host/bin/clang+0x71696bc)
#30 0x000056463633c3bf clang::driver::CC1Command::Execute(llvm::ArrayRef<llvm::Optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const (/b/sanitizer-x86_64-linux-qemu/build/llvm_build2_host/bin/clang+0x7bbb3bf)
#31 0x00005646362fc8bf clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/b/sanitizer-x86_64-linux-qemu/build/llvm_build2_host/bin/clang+0x7b7b8bf)
#32 0x00005646362fcb6e clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/b/sanitizer-x86_64-linux-qemu/build/llvm_build2_host/bin/clang+0x7b7bb6e)
#33 0x0000564636319a90 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/b/sanitizer-x86_64-linux-qemu/build/llvm_build2_host/bin/clang+0x7b98a90)
#34 0x00005646334fdbab clang_main(int, char**) (/b/sanitizer-x86_64-linux-qemu/build/llvm_build2_host/bin/clang+0x4d7cbab)
#35 0x00007fc8bfdfed90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#36 0x00007fc8bfdfee40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#37 0x00005646334fb125 _start (/b/sanitizer-x86_64-linux-qemu/build/llvm_build2_host/bin/clang+0x4d7a125)
clang-16: error: clang frontend command failed with exit code 134 (use -v to see invocation)
clang version 16.0.0 (https://github.com/llvm/llvm-project.git 67268ee11c220b1dfdf84afb10a12371c5ae6400)
Target: mips64-unknown-linux-gnuabi64
Thread model: posix
InstalledDir: /b/sanitizer-x86_64-linux-qemu/build/llvm_build2_host/bin
clang-16: note: diagnostic msg:
********************
PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-16: note: diagnostic msg: /tmp/gtest-all-9635e9.cpp
clang-16: note: diagnostic msg: /tmp/gtest-all-9635e9.sh
clang-16: note: diagnostic msg:
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJztWktz2zgS_jXyBUUV34-DD7QsJ9qxY5WlzFTthQWCoMQNRWoA0I_99dsASZmg5XGcsTKHTUoxJTy6v240uhtNpHX2dD7xze5jXk7M-CpeXM8vJ06MyiKd2FecNFktnwJXGS7risIPQbng8FzJzq9VIday4Tb9DyWCTzey28BlOSVkuiv23HenNYLhih6G4cV_KTMeQz_xXaMsqubR-JPuGjmiKcoMnmV5v0vUDztpKSTdiI9GpYQm2c-CB3x8-Pw4u23NhewqKvhLSlxtkJEvFzNk_AGywd-qNpqq4TQz9pjhHRWU9a3fqvqhMh4wq4pqY9R7UdQVMgyB2YaKiXPZitJh2FQNTgvfhcliyyjODI5zKp7Gvw1Gc8poReiLnpQKjIxbBxkboEmBUVpSbtRVCVQ2LSpS38NsmPJQCLI1MprjphRtH282G7locggrMmBw-Wk9X62TL7fJ9fXvN8nq63J5e7cG6Nah73O8Su7W6wU0mshYvFvRxp7V0mK6n_BoRFFKu2qAhFxE-Lqp601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