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

    <tr>
        <th>Summary</th>
        <td>
            clang crashes at -O{s,2,3} on x86_64-linux-gnu: Assertion `DAG.isGuaranteedNotToBeUndefOrPoison(R, false) && "Can't create node that may be undef/poison!"' failed 
        </td>
    </tr>

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

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

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

<pre>
    Compiler Explorer: https://godbolt.org/z/n9bGdvh77

```
[508] % clangtk -v
clang version 19.0.0git (https://github.com/llvm/llvm-project.git 8917afaf0ec2ebe390284e3727e720eaf97967eb)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /local/suz-local/software/local/clang-trunk/bin
Build config: +assertions
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/10
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/11
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/9
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/11
Candidate multilib: .;@m64
Selected multilib: .;@m64
[509] % 
[509] % clangtk -O2 small.c
clang-19: /local/suz-local/software/clangbuild/llvm-project/llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:15700: llvm::SDValue {anonymous}::DAGCombiner::visitFREEZE(llvm::SDNode*): Assertion `DAG.isGuaranteedNotToBeUndefOrPoison(R, false) && "Can't create node that may be undef/poison!"' 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: /local/suz-local/software/local/clang-trunk/bin/clang-19 -cc1 -triple x86_64-unknown-linux-gnu -emit-obj -dumpdir a- -disable-free -clear-ast-before-backend -main-file-name small.c -mrelocation-model pic -pic-level 2 -pic-is-pie -mframe-pointer=none -fmath-errno -ffp-contract=on -fno-rounding-math -mconstructor-aliases -funwind-tables=2 -target-cpu x86-64 -tune-cpu generic -debugger-tuning=gdb -fdebug-compilation-dir=/local/suz-local/software/emitesting/bugs/20240602-clangtk-m64-Os-build-223326/delta -fcoverage-compilation-dir=/local/suz-local/software/emitesting/bugs/20240602-clangtk-m64-Os-build-223326/delta -resource-dir /local/suz-local/software/local/clang-trunk/lib/clang/19 -I /usr/local/include -I /local/suz-local/software/local/include -internal-isystem /local/suz-local/software/local/clang-trunk/lib/clang/19/include -internal-isystem /usr/local/include -internal-isystem /usr/lib/gcc/x86_64-linux-gnu/11/../../../../x86_64-linux-gnu/include -internal-externc-isystem /usr/include/x86_64-linux-gnu -internal-externc-isystem /include -internal-externc-isystem /usr/include -O2 -ferror-limit 19 -fgnuc-version=4.2.1 -fskip-odr-check-in-gmf -fcolor-diagnostics -vectorize-loops -vectorize-slp -faddrsig -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o /tmp/small-ca29ca.o -x c small.c
1.      <eof> parser at end of file
2.      Code generation
3.      Running pass 'Function Pass Manager' on module 'small.c'.
4.      Running pass 'X86 DAG->DAG Instruction Selection' on function '@main'
 #0 0x0000556dc7feed9f llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/local/suz-local/software/local/clang-trunk/bin/clang-19+0x40ccd9f)
 #1 0x0000556dc7fec2c4 SignalHandler(int) Signals.cpp:0:0
 #2 0x00007fcf1b3f5420 __restore_rt (/lib/x86_64-linux-gnu/libpthread.so.0+0x14420)
 #3 0x00007fcf1ae2c00b raise /build/glibc-LcI20x/glibc-2.31/signal/../sysdeps/unix/sysv/linux/raise.c:51:1
 #4 0x00007fcf1ae0b859 abort /build/glibc-LcI20x/glibc-2.31/stdlib/abort.c:81:7
 #5 0x00007fcf1ae0b729 get_sysdep_segment_value /build/glibc-LcI20x/glibc-2.31/intl/loadmsgcat.c:509:8
 #6 0x00007fcf1ae0b729 _nl_load_domain /build/glibc-LcI20x/glibc-2.31/intl/loadmsgcat.c:970:34
 #7 0x00007fcf1ae1cfd6 (/lib/x86_64-linux-gnu/libc.so.6+0x33fd6)
 #8 0x0000556dc9053a58 (/local/suz-local/software/local/clang-trunk/bin/clang-19+0x5131a58)
 #9 0x0000556dc90e3652 (anonymous namespace)::DAGCombiner::visit(llvm::SDNode*) DAGCombiner.cpp:0:0
#10 0x0000556dc90e4b94 (anonymous namespace)::DAGCombiner::combine(llvm::SDNode*) DAGCombiner.cpp:0:0
#11 0x0000556dc90e65dc (anonymous namespace)::DAGCombiner::Run(llvm::CombineLevel) DAGCombiner.cpp:0:0
#12 0x0000556dc90e8bca llvm::SelectionDAG::Combine(llvm::CombineLevel, llvm::AAResults*, llvm::CodeGenOptLevel) (/local/suz-local/software/local/clang-trunk/bin/clang-19+0x51c6bca)
#13 0x0000556dc9221822 llvm::SelectionDAGISel::CodeGenAndEmitDAG() (/local/suz-local/software/local/clang-trunk/bin/clang-19+0x52ff822)
#14 0x0000556dc922546d llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) (/local/suz-local/software/local/clang-trunk/bin/clang-19+0x530346d)
#15 0x0000556dc9226ea6 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) (.part.0) SelectionDAGISel.cpp:0:0
#16 0x0000556dc6b156f0 (anonymous namespace)::X86DAGToDAGISel::runOnMachineFunction(llvm::MachineFunction&) X86ISelDAGToDAG.cpp:0:0
#17 0x0000556dc7368401 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (.part.0) MachineFunctionPass.cpp:0:0
#18 0x0000556dc795862b llvm::FPPassManager::runOnFunction(llvm::Function&) (/local/suz-local/software/local/clang-trunk/bin/clang-19+0x3a3662b)
#19 0x0000556dc7958879 llvm::FPPassManager::runOnModule(llvm::Module&) (/local/suz-local/software/local/clang-trunk/bin/clang-19+0x3a36879)
#20 0x0000556dc7959135 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/local/suz-local/software/local/clang-trunk/bin/clang-19+0x3a37135)
#21 0x0000556dc828f903 (anonymous namespace)::EmitAssemblyHelper::EmitAssembly(clang::BackendAction, std::unique_ptr<llvm::raw_pwrite_stream, std::default_delete<llvm::raw_pwrite_stream>>, clang::BackendConsumer*) BackendUtil.cpp:0:0
#22 0x0000556dc828fd06 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*) (/local/suz-local/software/local/clang-trunk/bin/clang-19+0x436dd06)
#23 0x0000556dc88ef699 clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/local/suz-local/software/local/clang-trunk/bin/clang-19+0x49cd699)
#24 0x0000556dca692a8c clang::ParseAST(clang::Sema&, bool, bool) (/local/suz-local/software/local/clang-trunk/bin/clang-19+0x6770a8c)
#25 0x0000556dc88efb28 clang::CodeGenAction::ExecuteAction() (/local/suz-local/software/local/clang-trunk/bin/clang-19+0x49cdb28)
#26 0x0000556dc8b80539 clang::FrontendAction::Execute() (/local/suz-local/software/local/clang-trunk/bin/clang-19+0x4c5e539)
#27 0x0000556dc8b0598e clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/local/suz-local/software/local/clang-trunk/bin/clang-19+0x4be398e)
#28 0x0000556dc8c6a736 clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/local/suz-local/software/local/clang-trunk/bin/clang-19+0x4d48736)
#29 0x0000556dc519e0cc cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/local/suz-local/software/local/clang-trunk/bin/clang-19+0x127c0cc)
#30 0x0000556dc51972ca ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#31 0x0000556dc519ac9e clang_main(int, char**, llvm::ToolContext const&) (/local/suz-local/software/local/clang-trunk/bin/clang-19+0x1278c9e)
#32 0x0000556dc509193b main (/local/suz-local/software/local/clang-trunk/bin/clang-19+0x116f93b)
#33 0x00007fcf1ae0d083 __libc_start_main /build/glibc-LcI20x/glibc-2.31/csu/../csu/libc-start.c:342:3
#34 0x0000556dc5196d5e _start (/local/suz-local/software/local/clang-trunk/bin/clang-19+0x1274d5e)
clangtk: error: unable to execute command: Aborted
clangtk: error: clang frontend command failed due to signal (use -v to see invocation)
clang version 19.0.0git (https://github.com/llvm/llvm-project.git 8917afaf0ec2ebe390284e3727e720eaf97967eb)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /local/suz-local/software/local/clang-trunk/bin
Build config: +assertions
clangtk: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clangtk: note: diagnostic msg: /tmp/small-cf6d33.c
clangtk: note: diagnostic msg: /tmp/small-cf6d33.sh
clangtk: note: diagnostic msg: 

********************
[510] % 
[510] % cat small.c
int a, b, c;
unsigned d;
short e;
int main() {
  while (c) {
    int f = b & e;
    a = b;
    b = -1u << (~f && a);
    e = (a || d % b) * ~b;
  }
  return 0;
}
```
</pre>
<img width="1px" height="1px" alt="" src="http://email.email.llvm.org/o/eJzsWk9z27iS_zTIBQUVCYr_Dj7QkuW4KjN22Z55U3tRgUBTxgsJaAHQcebwPvsWQEomFSdOZpzdOWyVo0gNoPvXjUZ34w-zVu4UwBlKz1G6fsd696DN2Z8PoIRWO9u_q7X4fLbS3V62YPDF077VBgxKKvzg3N6ipEJ0g-hmp0WtW7fQZofo5k9EN6qsL8XjQ56jaI2iavzMovFv-Jmep1GB0jVGNMW8ZWrnPmLyOLSG3_gRjJVa4bhcRItoJx1GtDgRLt1DXy-47hDdtO3j4T-yN_rfwN3CjyrKOGcNayLgFGpIyogWS0hymkNOI2BNmZdZDjWi5SD-npkdOK_qU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