llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
28.26k stars 11.67k forks source link

[Clang] Assertion trunk crashes at llvm::X86TargetLowering::LowerSET_ROUNDING(llvm::SDValue, llvm::SelectionDAG&) const #110776

Open yijan4845 opened 5 hours ago

yijan4845 commented 5 hours ago

Compiler Explorer: https://godbolt.org/z/Y6qM8chGK

Attempting to compile below program with Clang Assertion Trunk:

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
llvmbot commented 5 hours ago

@llvm/issue-subscribers-backend-x86

Author: Yihan Yang (yijan4845)

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 ```