<table border="1" cellspacing="0" cellpadding="8">
    <tr>
        <th>Issue</th>
        <td>
            <a href=https://github.com/llvm/llvm-project/issues/110776>110776</a>
        </td>
    </tr>

    <tr>
        <th>Summary</th>
        <td>
            [Clang] Assertion trunk crashes at llvm::X86TargetLowering::LowerSET_ROUNDING(llvm::SDValue, llvm::SelectionDAG&) const
        </td>
    </tr>

    <tr>
      <th>Labels</th>
      <td>
            clang
      </td>
    </tr>

    <tr>
      <th>Assignees</th>
      <td>
      </td>
    </tr>

    <tr>
      <th>Reporter</th>
      <td>
          yijan4845
      </td>
    </tr>
</table>

<pre>
    Compiler Explorer: [https://godbolt.org/z/Y6qM8chGK](https://godbolt.org/z/Y6qM8chGK)

Attempting to compile below program with Clang Assertion Trunk:
```c
int main() {
  __builtin_set_flt_rounds(4);
}
```
Stack dump:
```
rounding mode is not supported by X86 hardware
UNREACHABLE executed at /root/llvm-project/llvm/lib/Target/X86/X86ISelLowering.cpp:28001!
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: /opt/compiler-explorer/clang-assertions-trunk/bin/clang -gdwarf-4 -g -o /app/output.s -mllvm --x86-asm-syntax=intel -fno-verbose-asm -S --gcc-toolchain=/opt/compiler-explorer/gcc-snapshot -fcolor-diagnostics -fno-crash-diagnostics -O3 <source>
1.      <eof> parser at end of file
2.      Code generation
3.      Running pass 'Function Pass Manager' on module '<source>'.
4.      Running pass 'X86 DAG->DAG Instruction Selection' on function '@main'
 #0 0x0000000003b93538 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3b93538)
 #1 0x0000000003b911fc llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3b911fc)
 #2 0x0000000003adf908 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
 #3 0x000074fe20242520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #4 0x000074fe202969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
 #5 0x000074fe20242476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
 #6 0x000074fe202287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
 #7 0x0000000003aeb1da (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3aeb1da)
 #8 0x000000000272f2cf llvm::X86TargetLowering::LowerSET_ROUNDING(llvm::SDValue, llvm::SelectionDAG&) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x272f2cf)
 #9 0x0000000002820a84 llvm::X86TargetLowering::LowerOperation(llvm::SDValue, llvm::SelectionDAG&) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x2820a84)
#10 0x0000000004d63b98 (anonymous namespace)::SelectionDAGLegalize::LegalizeOp(llvm::SDNode*) (.part.0) LegalizeDAG.cpp:0:0
#11 0x0000000004d67273 llvm::SelectionDAG::Legalize() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4d67273)
#12 0x0000000004e58467 llvm::SelectionDAGISel::CodeGenAndEmitDAG() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4e58467)
#13 0x0000000004e5b6b2 llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4e5b6b2)
#14 0x0000000004e5c9d0 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4e5c9d0)
#15 0x0000000004e4d70f llvm::SelectionDAGISelLegacy::runOnMachineFunction(llvm::MachineFunction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4e4d70f)
#16 0x0000000002efeb09 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (.part.0) MachineFunctionPass.cpp:0:0
#17 0x00000000034fa020 llvm::FPPassManager::runOnFunction(llvm::Function&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x34fa020)
#18 0x00000000034fa3d1 llvm::FPPassManager::runOnModule(llvm::Module&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x34fa3d1)
#19 0x00000000034fac87 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x34fac87)
#20 0x0000000003e41945 clang::EmitBackendOutput(clang::DiagnosticsEngine&, clang::HeaderSearchOptions const&, clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions const&, llvm::StringRef, llvm::Module*, clang::BackendAction, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream>>, clang::BackendConsumer*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3e41945)
#21 0x00000000044e8f0e clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x44e8f0e)
#22 0x000000000660d50c clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x660d50c)
#23 0x00000000044e92f8 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x44e92f8)
#24 0x00000000047a2c89 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x47a2c89)
#25 0x000000000472199e clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x472199e)
#26 0x00000000048887ae clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x48887ae)
#27 0x0000000000cd779f cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0xcd779f)
#28 0x0000000000ccf4aa ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#29 0x000000000452d579 void llvm::function_ref<void ()>::callback_fn<clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const::'lambda'()>(long) Job.cpp:0:0
#30 0x0000000003adfdb4 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3adfdb4)
#31 0x000000000452db6f clang::driver::CC1Command::Execute(llvm::ArrayRef<std::optional<llvm::StringRef>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>*, bool*) const (.part.0) Job.cpp:0:0
#32 0x00000000044f2efd clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x44f2efd)
#33 0x00000000044f3fed clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x44f3fed)
#34 0x00000000044fbca5 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x44fbca5)
#35 0x0000000000cd466f clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0xcd466f)
#36 0x0000000000ba3b84 main (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0xba3b84)
#37 0x000074fe20229d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#38 0x000074fe20229e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#39 0x0000000000ccef5e _start (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0xccef5e)
clang: error: clang frontend command failed with exit code 134 (use -v to see invocation)
Compiler returned: 134
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzkWl1zo7jS_jXkRmUXCMzHRS6IHWdn35lJKs5u7XvlEqKx2WCJlUQm2V9_ShLEiDjzcY7P1FadqYlt9NH9dOtRqyVEpKx3DODSW1x5i9UF6dSei8uX-k_CojRaXBS8fLlc8kNbNyDQ9XPbcAHCC3PkLa72SrXSC3MPrz283vGy4I2ac7Hz8PpvD6__P_7rU0r3N__nLVYeTr-_Oc48f-X5uf3MlYJDq2q2Q4ojasGgAhr-BbWC7wQ5oC-12qNlQ9gO5VKCUDVn6EF07FErtMJi3_6n9rlmCh1IzTycejhDXnJlyxHabouublTNthLUtmrUVvCOldLDaaSxhX1LL1lNRNvHjSL0EZXdoX2r3D4aedqgAy8B1RIxrpDs2pYLBSUqXtAfaYz2RJRfiADb57fP99f58pf86uM1gmegnW5JFPLwWnCuPLxumqfDrBX8T6DDo_6qCw-vH4jYgS79I43t54cNNB_5FxA1281pq7Hi1PcDDwdW4d3H63xzjWRXHGqFCCq6HRKgIepxmIxmrfZdMaf8MFLswqml7EB6eI0IK1HNaNOVgNQeEBVE7lFB6KMShIKHl6gV0ApOQUookeSdsMW6J5GS05po60XHkKSibtX8Xc_7c8_P7nqaELHrDsCUNAzGa95qZD2lxAwGfuM11VyakYFLcqYMmfC60Iyx1Wi20-NTzSI026EZ1xJJ22q5nWo7NZdodtBeQLPZcxrPiDzM5AtT5NkLVzVT0KBZxfjsCUTBJeh6NNug2WxH6Uxx3tC95me4-ipS3Vgy0so9V2hWUd5wMStrsmNcqppKq8P42C2-DZEXLnvnhtfWXYF2lxcugVdeeI1aIiQITTNgJeIVquqm5yPWLZeavztgIIh2k60Jdc19x5hmeEukRB5O1h2jZlbe6YJPhJGdhp8gzvQs6BrQrRxAOOmHNTolUM-QVX4z88LrVX6DPjCpRGdVbKAB86uXXw26tYbIt7M-6ae7h0Mf-c_-8C8ssnARpsiwOMy9MJcv0v64EzVThmMPlqjpsZEgX7ZcKg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