| Issue |
204079
|
| Summary |
[X86] This target-independent node should have been selected!
|
| Labels |
backend:X86,
crash-on-valid,
generated by fuzzer
|
| Assignees |
|
| Reporter |
XChy
|
Reproducer: https://godbolt.org/z/evvqP14Kn
Testcase:
```c
#include <stdint.h>
int16_t g5, g29, g27, g19, g17;
_Bool g13, g14, g30, f12_ob8;
int32_t g21;
void *g24;
void hash();
void f12(int64_t a1)
{
int32_t arr5[2];
int32_t v9;
void *p10;
_Bool c14;
int32_t bb16;
f12_ob8 = 0;
if (f12_ob8)
p10 = &bb16;
else
{
p10 = &v9;
g24 = p10;
}
if (c14)
{
p10 = &c14;
g29 = 1;
}
hash();
g29 = g27 = *(_Bool *)p10;
g14 = g13;
uint16_t __ov_tmp_g27;
g14 = __builtin_add_overflow(g5, g17, &__ov_tmp_g27);
g27 = __ov_tmp_g27;
g14 = 0;
p10 = g24;
g17 = g19;
c14 = g5 = g19 = g13 = __builtin_sub_overflow(0, 0, &g5);
arr5[1] = g21;
g30 = a1;
g21 = v9;
bb16 = arr5[1];
g30 = bb16;
v9 = arr5[1];
*(int8_t *)p10 = 0;
}
```
This testcase crashed clang at -O1:
```
t177: ch = <<Deleted Node!>>, example.cpp:41:11
This target-independent node should have been selected!
UNREACHABLE executed at /root/llvm-project/llvm/lib/CodeGen/SelectionDAG/InstrEmitter.cpp:1263!
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-22.1.0/bin/clang++ -g -o /app/output.s -mllvm --x86-asm-syntax=intel -fno-verbose-asm -S --gcc-toolchain=/opt/compiler-explorer/gcc-15.2.0 -fcolor-diagnostics -fno-crash-diagnostics -x c -O1 <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 '@f12'
#0 0x0000000004281028 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-22.1.0/bin/clang+++0x4281028)
#1 0x000000000427e464 llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-22.1.0/bin/clang+++0x427e464)
#2 0x00000000041c0d58 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
#3 0x00007b5f66245330 (/lib/x86_64-linux-gnu/libc.so.6+0x45330)
#4 0x00007b5f6629eb2c pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x9eb2c)
#5 0x00007b5f6624527e raise (/lib/x86_64-linux-gnu/libc.so.6+0x4527e)
#6 0x00007b5f662288ff abort (/lib/x86_64-linux-gnu/libc.so.6+0x288ff)
#7 0x00000000041cb7ea (/opt/compiler-explorer/clang-assertions-22.1.0/bin/clang+++0x41cb7ea)
#8 0x00000000059e82d0 llvm::InstrEmitter::EmitSpecialNode(llvm::SDNode*, bool, bool, llvm::SmallDenseMap<llvm::SDValue, llvm::Register, 16u, llvm::DenseMapInfo<llvm::SDValue, void>, llvm::detail::DenseMapPair<llvm::SDValue, llvm::Register>>&) (/opt/compiler-explorer/clang-assertions-22.1.0/bin/clang+++0x59e82d0)
#9 0x00000000059d56bb llvm::ScheduleDAGSDNodes::EmitSchedule(llvm::MachineInstrBundleIterator<llvm::MachineInstr, false>&)::'lambda'(llvm::SDNode*, bool, bool, llvm::SmallDenseMap<llvm::SDValue, llvm::Register, 16u, llvm::DenseMapInfo<llvm::SDValue, void>, llvm::detail::DenseMapPair<llvm::SDValue, llvm::Register>>&)::operator()(llvm::SDNode*, bool, bool, llvm::SmallDenseMap<llvm::SDValue, llvm::Register, 16u, llvm::DenseMapInfo<llvm::SDValue, void>, llvm::detail::DenseMapPair<llvm::SDValue, llvm::Register>>&) const ScheduleDAGSDNodes.cpp:0:0
#10 0x00000000059d9ea2 llvm::ScheduleDAGSDNodes::EmitSchedule(llvm::MachineInstrBundleIterator<llvm::MachineInstr, false>&) (/opt/compiler-explorer/clang-assertions-22.1.0/bin/clang+++0x59d9ea2)
#11 0x00000000058c6e1e llvm::SelectionDAGISel::CodeGenAndEmitDAG() (/opt/compiler-explorer/clang-assertions-22.1.0/bin/clang+++0x58c6e1e)
#12 0x00000000058c9d08 llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) (/opt/compiler-explorer/clang-assertions-22.1.0/bin/clang+++0x58c9d08)
#13 0x00000000058cb81c llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) (/opt/compiler-explorer/clang-assertions-22.1.0/bin/clang+++0x58cb81c)
#14 0x00000000058b6a8f llvm::SelectionDAGISelLegacy::runOnMachineFunction(llvm::MachineFunction&) (/opt/compiler-explorer/clang-assertions-22.1.0/bin/clang+++0x58b6a8f)
#15 0x0000000003510959 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (.part.0) MachineFunctionPass.cpp:0:0
#16 0x0000000003b6b7d6 llvm::FPPassManager::runOnFunction(llvm::Function&) (/opt/compiler-explorer/clang-assertions-22.1.0/bin/clang+++0x3b6b7d6)
#17 0x0000000003b6bb81 llvm::FPPassManager::runOnModule(llvm::Module&) (/opt/compiler-explorer/clang-assertions-22.1.0/bin/clang+++0x3b6bb81)
#18 0x0000000003b6c3ef llvm::legacy::PassManagerImpl::run(llvm::Module&) (/opt/compiler-explorer/clang-assertions-22.1.0/bin/clang+++0x3b6c3ef)
#19 0x00000000045425dc (anonymous namespace)::EmitAssemblyHelper::RunCodegenPipeline(clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream>>&, std::unique_ptr<llvm::ToolOutputFile, std::default_delete<llvm::ToolOutputFile>>&) BackendUtil.cpp:0:0
#20 0x0000000004542e81 clang::emitBackendOutput(clang::CompilerInstance&, clang::CodeGenOptions&, 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-22.1.0/bin/clang+++0x4542e81)
#21 0x0000000004be6427 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/opt/compiler-explorer/clang-assertions-22.1.0/bin/clang+++0x4be6427)
#22 0x00000000069982ac clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-22.1.0/bin/clang+++0x69982ac)
#23 0x0000000004be6888 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-22.1.0/bin/clang+++0x4be6888)
#24 0x0000000004edfeb5 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-22.1.0/bin/clang+++0x4edfeb5)
#25 0x0000000004e5fc8e clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-22.1.0/bin/clang+++0x4e5fc8e)
#26 0x0000000004fda60d clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-22.1.0/bin/clang+++0x4fda60d)
#27 0x0000000000dcffde cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-assertions-22.1.0/bin/clang+++0xdcffde)
#28 0x0000000000dc69ca ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&, llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem>) driver.cpp:0:0
#29 0x0000000000dc6b4d int llvm::function_ref<int (llvm::SmallVectorImpl<char const*>&)>::callback_fn<clang_main(int, char**, llvm::ToolContext const&)::'lambda'(llvm::SmallVectorImpl<char const*>&)>(long, llvm::SmallVectorImpl<char const*>&) driver.cpp:0:0
#30 0x0000000004c59bf9 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
#31 0x00000000041c11f4 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-assertions-22.1.0/bin/clang+++0x41c11f4)
#32 0x0000000004c5a20f 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
#33 0x0000000004c1aba2 clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-assertions-22.1.0/bin/clang+++0x4c1aba2)
#34 0x0000000004c1bb4e clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&, bool) const (/opt/compiler-explorer/clang-assertions-22.1.0/bin/clang+++0x4c1bb4e)
#35 0x0000000004c22fa5 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-assertions-22.1.0/bin/clang+++0x4c22fa5)
#36 0x0000000000dcc371 clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-assertions-22.1.0/bin/clang+++0xdcc371)
#37 0x0000000000c89a84 main (/opt/compiler-explorer/clang-assertions-22.1.0/bin/clang+++0xc89a84)
#38 0x00007b5f6622a1ca (/lib/x86_64-linux-gnu/libc.so.6+0x2a1ca)
#39 0x00007b5f6622a28b __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2a28b)
#40 0x0000000000dc6465 _start (/opt/compiler-explorer/clang-assertions-22.1.0/bin/clang+++0xdc6465)
clang++: error: clang frontend command failed with exit code 134 (use -v to see invocation)
Compiler returned: 134
```
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs