Skip to content

[clang] Crash at O2: Assertion `llvm::isUIntN(BitWidth, val) && "Value is not an N-bit unsigned value"' failed. #118934

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
cardigan1008 opened this issue Dec 6, 2024 · 3 comments

Comments

@cardigan1008
Copy link

This code crashed at O2:

static char c = -2, l;
char d;
int e, f, b, k;
static char *g = &d;
long h;
static int *i = &f;
char a;
int m(int n) {
  if (n < 0)
    return n;
  return 0;
}
void o(long n) { *i = m(c + 6) + c + n; }
void main() {
  a = c;
  char *j[2] = {&g};
  for (; b;)
    ;
  *g = 0;
  e |= 0 != h;
  l = *g;
  o(l != 0);
  c = 7;
  for (;; c = 0)
    k = *i + *i;
}

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

Bisected to 3e1b55c which was committed by @nikic

The crash is:

clang: /root/llvm-project/llvm/include/llvm/ADT/APInt.h:127: llvm::APInt::APInt(unsigned int, uint64_t, bool, bool): Assertion `llvm::isUIntN(BitWidth, val) && "Value is not an N-bit unsigned value"' failed.

Backtrace:

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 -O2 -Wall -Wextra -fno-strict-aliasing <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 0x0000000003c01b78 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3c01b78)
 #1 0x0000000003bff87c llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3bff87c)
 #2 0x0000000003b4cd78 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
 #3 0x00007dabed242520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #4 0x00007dabed2969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
 #5 0x00007dabed242476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
 #6 0x00007dabed2287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
 #7 0x00007dabed22871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
 #8 0x00007dabed239e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
 #9 0x0000000004ed6c79 llvm::SelectionDAG::getConstant(unsigned long, llvm::SDLoc const&, llvm::EVT, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4ed6c79)
#10 0x00000000026d7805 (anonymous namespace)::X86DAGToDAGISel::matchIndexRecursively(llvm::SDValue, (anonymous namespace)::X86ISelAddressMode&, unsigned int) X86ISelDAGToDAG.cpp:0:0
#11 0x00000000026d7c89 (anonymous namespace)::X86DAGToDAGISel::matchIndexRecursively(llvm::SDValue, (anonymous namespace)::X86ISelAddressMode&, unsigned int) X86ISelDAGToDAG.cpp:0:0
#12 0x00000000026d952a (anonymous namespace)::X86DAGToDAGISel::matchAddressRecursively(llvm::SDValue, (anonymous namespace)::X86ISelAddressMode&, unsigned int) X86ISelDAGToDAG.cpp:0:0
#13 0x00000000026dab90 (anonymous namespace)::X86DAGToDAGISel::selectLEAAddr(llvm::SDValue, llvm::SDValue&, llvm::SDValue&, llvm::SDValue&, llvm::SDValue&, llvm::SDValue&) X86ISelDAGToDAG.cpp:0:0
#14 0x00000000026eb1c7 (anonymous namespace)::X86DAGToDAGISel::CheckComplexPattern(llvm::SDNode*, llvm::SDNode*, llvm::SDValue, unsigned int, llvm::SmallVectorImpl<std::pair<llvm::SDValue, llvm::SDNode*>>&) X86ISelDAGToDAG.cpp:0:0
#15 0x0000000004f0ba37 llvm::SelectionDAGISel::SelectCodeCommon(llvm::SDNode*, unsigned char const*, unsigned int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4f0ba37)
#16 0x00000000026e0cf1 (anonymous namespace)::X86DAGToDAGISel::Select(llvm::SDNode*) X86ISelDAGToDAG.cpp:0:0
#17 0x0000000004f0106b llvm::SelectionDAGISel::DoInstructionSelection() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4f0106b)
#18 0x0000000004f1026a llvm::SelectionDAGISel::CodeGenAndEmitDAG() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4f1026a)
#19 0x0000000004f137e9 llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4f137e9)
#20 0x0000000004f14aa0 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4f14aa0)
#21 0x0000000004f0544f llvm::SelectionDAGISelLegacy::runOnMachineFunction(llvm::MachineFunction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4f0544f)
#22 0x0000000002f54029 llvm::MachineFunctionPass::runOnFunction(llvm::Function&) (.part.0) MachineFunctionPass.cpp:0:0
#23 0x000000000355b57f llvm::FPPassManager::runOnFunction(llvm::Function&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x355b57f)
#24 0x000000000355b931 llvm::FPPassManager::runOnModule(llvm::Module&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x355b931)
#25 0x000000000355c1d1 llvm::legacy::PassManagerImpl::run(llvm::Module&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x355c1d1)
#26 0x0000000003eb4a33 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+0x3eb4a33)
#27 0x000000000458355e clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x458355e)
#28 0x000000000653a51c clang::ParseAST(clang::Sema&, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x653a51c)
#29 0x0000000004583938 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4583938)
#30 0x000000000483e9b9 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x483e9b9)
#31 0x00000000047be64e clang::CompilerInstance::ExecuteAction(clang::FrontendAction&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x47be64e)
#32 0x0000000004929a1e clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4929a1e)
#33 0x0000000000cb12df cc1_main(llvm::ArrayRef<char const*>, char const*, void*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0xcb12df)
#34 0x0000000000ca8e7a ExecuteCC1Tool(llvm::SmallVectorImpl<char const*>&, llvm::ToolContext const&) driver.cpp:0:0
#35 0x00000000045c6b89 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
#36 0x0000000003b4d224 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref<void ()>) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3b4d224)
#37 0x00000000045c717f 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
#38 0x000000000458d41d clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&, clang::driver::Command const*&, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x458d41d)
#39 0x000000000458e50d 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+0x458e50d)
#40 0x00000000045958c5 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&, llvm::SmallVectorImpl<std::pair<int, clang::driver::Command const*>>&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x45958c5)
#41 0x0000000000cae123 clang_main(int, char**, llvm::ToolContext const&) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0xcae123)
#42 0x0000000000b82494 main (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0xb82494)
#43 0x00007dabed229d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#44 0x00007dabed229e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#45 0x0000000000ca892e _start (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0xca892e)
@github-actions github-actions bot added the clang Clang issues not falling into any other category label Dec 6, 2024
@topperc
Copy link
Collaborator

topperc commented Dec 6, 2024

I haven't tested this, but maybe something like this

diff --git a/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp b/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
index 93d196d0fde5..76ef207f7d47 100644
--- a/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
+++ b/llvm/lib/Target/X86/X86ISelDAGToDAG.cpp
@@ -2423,11 +2423,11 @@ SDValue X86DAGToDAGISel::matchIndexRecursively(SDValue N,
       if (CurDAG->isBaseWithConstantOffset(Src)) {
         SDValue AddSrc = Src.getOperand(0);
         auto *AddVal = cast<ConstantSDNode>(Src.getOperand(1));
-        uint64_t Offset = (uint64_t)AddVal->getSExtValue();
-        if (!foldOffsetIntoAddress(Offset * AM.Scale, AM)) {
+        int64_t Offset = AddVal->getSExtValue();
+        if (!foldOffsetIntoAddress((uint64_t)Offset * AM.Scale, AM)) {
           SDLoc DL(N);
           SDValue ExtSrc = CurDAG->getNode(Opc, DL, VT, AddSrc);
-          SDValue ExtVal = CurDAG->getConstant(Offset, DL, VT);
+          SDValue ExtVal = CurDAG->getSignedConstant(Offset, DL, VT);
           SDValue ExtAdd = CurDAG->getNode(ISD::ADD, DL, VT, ExtSrc, ExtVal);
           insertDAGNode(*CurDAG, N, ExtSrc);
           insertDAGNode(*CurDAG, N, ExtVal);

@dtcxzyw dtcxzyw added backend:X86 crash-on-valid and removed clang Clang issues not falling into any other category labels Dec 6, 2024
@llvmbot
Copy link
Member

llvmbot commented Dec 6, 2024

@llvm/issue-subscribers-backend-x86

Author: Yunbo Ni (cardigan1008)

This code crashed at O2:
static char c = -2, l;
char d;
int e, f, b, k;
static char *g = &amp;d;
long h;
static int *i = &amp;f;
char a;
int m(int n) {
  if (n &lt; 0)
    return n;
  return 0;
}
void o(long n) { *i = m(c + 6) + c + n; }
void main() {
  a = c;
  char *j[2] = {&amp;g};
  for (; b;)
    ;
  *g = 0;
  e |= 0 != h;
  l = *g;
  o(l != 0);
  c = 7;
  for (;; c = 0)
    k = *i + *i;
}

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

Bisected to 3e1b55c which was committed by @nikic

The crash is:

clang: /root/llvm-project/llvm/include/llvm/ADT/APInt.h:127: llvm::APInt::APInt(unsigned int, uint64_t, bool, bool): Assertion `llvm::isUIntN(BitWidth, val) &amp;&amp; "Value is not an N-bit unsigned value"' failed.

Backtrace:

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 -O2 -Wall -Wextra -fno-strict-aliasing &lt;source&gt;
1.	&lt;eof&gt; parser at end of file
2.	Code generation
3.	Running pass 'Function Pass Manager' on module '&lt;source&gt;'.
4.	Running pass 'X86 DAG-&gt;DAG Instruction Selection' on function '@<!-- -->main'
 #<!-- -->0 0x0000000003c01b78 llvm::sys::PrintStackTrace(llvm::raw_ostream&amp;, int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3c01b78)
 #<!-- -->1 0x0000000003bff87c llvm::sys::CleanupOnSignal(unsigned long) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3bff87c)
 #<!-- -->2 0x0000000003b4cd78 CrashRecoverySignalHandler(int) CrashRecoveryContext.cpp:0:0
 #<!-- -->3 0x00007dabed242520 (/lib/x86_64-linux-gnu/libc.so.6+0x42520)
 #<!-- -->4 0x00007dabed2969fc pthread_kill (/lib/x86_64-linux-gnu/libc.so.6+0x969fc)
 #<!-- -->5 0x00007dabed242476 gsignal (/lib/x86_64-linux-gnu/libc.so.6+0x42476)
 #<!-- -->6 0x00007dabed2287f3 abort (/lib/x86_64-linux-gnu/libc.so.6+0x287f3)
 #<!-- -->7 0x00007dabed22871b (/lib/x86_64-linux-gnu/libc.so.6+0x2871b)
 #<!-- -->8 0x00007dabed239e96 (/lib/x86_64-linux-gnu/libc.so.6+0x39e96)
 #<!-- -->9 0x0000000004ed6c79 llvm::SelectionDAG::getConstant(unsigned long, llvm::SDLoc const&amp;, llvm::EVT, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4ed6c79)
#<!-- -->10 0x00000000026d7805 (anonymous namespace)::X86DAGToDAGISel::matchIndexRecursively(llvm::SDValue, (anonymous namespace)::X86ISelAddressMode&amp;, unsigned int) X86ISelDAGToDAG.cpp:0:0
#<!-- -->11 0x00000000026d7c89 (anonymous namespace)::X86DAGToDAGISel::matchIndexRecursively(llvm::SDValue, (anonymous namespace)::X86ISelAddressMode&amp;, unsigned int) X86ISelDAGToDAG.cpp:0:0
#<!-- -->12 0x00000000026d952a (anonymous namespace)::X86DAGToDAGISel::matchAddressRecursively(llvm::SDValue, (anonymous namespace)::X86ISelAddressMode&amp;, unsigned int) X86ISelDAGToDAG.cpp:0:0
#<!-- -->13 0x00000000026dab90 (anonymous namespace)::X86DAGToDAGISel::selectLEAAddr(llvm::SDValue, llvm::SDValue&amp;, llvm::SDValue&amp;, llvm::SDValue&amp;, llvm::SDValue&amp;, llvm::SDValue&amp;) X86ISelDAGToDAG.cpp:0:0
#<!-- -->14 0x00000000026eb1c7 (anonymous namespace)::X86DAGToDAGISel::CheckComplexPattern(llvm::SDNode*, llvm::SDNode*, llvm::SDValue, unsigned int, llvm::SmallVectorImpl&lt;std::pair&lt;llvm::SDValue, llvm::SDNode*&gt;&gt;&amp;) X86ISelDAGToDAG.cpp:0:0
#<!-- -->15 0x0000000004f0ba37 llvm::SelectionDAGISel::SelectCodeCommon(llvm::SDNode*, unsigned char const*, unsigned int) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4f0ba37)
#<!-- -->16 0x00000000026e0cf1 (anonymous namespace)::X86DAGToDAGISel::Select(llvm::SDNode*) X86ISelDAGToDAG.cpp:0:0
#<!-- -->17 0x0000000004f0106b llvm::SelectionDAGISel::DoInstructionSelection() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4f0106b)
#<!-- -->18 0x0000000004f1026a llvm::SelectionDAGISel::CodeGenAndEmitDAG() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4f1026a)
#<!-- -->19 0x0000000004f137e9 llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&amp;) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4f137e9)
#<!-- -->20 0x0000000004f14aa0 llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&amp;) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4f14aa0)
#<!-- -->21 0x0000000004f0544f llvm::SelectionDAGISelLegacy::runOnMachineFunction(llvm::MachineFunction&amp;) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4f0544f)
#<!-- -->22 0x0000000002f54029 llvm::MachineFunctionPass::runOnFunction(llvm::Function&amp;) (.part.0) MachineFunctionPass.cpp:0:0
#<!-- -->23 0x000000000355b57f llvm::FPPassManager::runOnFunction(llvm::Function&amp;) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x355b57f)
#<!-- -->24 0x000000000355b931 llvm::FPPassManager::runOnModule(llvm::Module&amp;) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x355b931)
#<!-- -->25 0x000000000355c1d1 llvm::legacy::PassManagerImpl::run(llvm::Module&amp;) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x355c1d1)
#<!-- -->26 0x0000000003eb4a33 clang::EmitBackendOutput(clang::DiagnosticsEngine&amp;, clang::HeaderSearchOptions const&amp;, clang::CodeGenOptions const&amp;, clang::TargetOptions const&amp;, clang::LangOptions const&amp;, llvm::StringRef, llvm::Module*, clang::BackendAction, llvm::IntrusiveRefCntPtr&lt;llvm::vfs::FileSystem&gt;, std::unique_ptr&lt;llvm::raw_pwrite_stream, std::default_delete&lt;llvm::raw_pwrite_stream&gt;&gt;, clang::BackendConsumer*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3eb4a33)
#<!-- -->27 0x000000000458355e clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&amp;) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x458355e)
#<!-- -->28 0x000000000653a51c clang::ParseAST(clang::Sema&amp;, bool, bool) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x653a51c)
#<!-- -->29 0x0000000004583938 clang::CodeGenAction::ExecuteAction() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4583938)
#<!-- -->30 0x000000000483e9b9 clang::FrontendAction::Execute() (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x483e9b9)
#<!-- -->31 0x00000000047be64e clang::CompilerInstance::ExecuteAction(clang::FrontendAction&amp;) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x47be64e)
#<!-- -->32 0x0000000004929a1e clang::ExecuteCompilerInvocation(clang::CompilerInstance*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x4929a1e)
#<!-- -->33 0x0000000000cb12df cc1_main(llvm::ArrayRef&lt;char const*&gt;, char const*, void*) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0xcb12df)
#<!-- -->34 0x0000000000ca8e7a ExecuteCC1Tool(llvm::SmallVectorImpl&lt;char const*&gt;&amp;, llvm::ToolContext const&amp;) driver.cpp:0:0
#<!-- -->35 0x00000000045c6b89 void llvm::function_ref&lt;void ()&gt;::callback_fn&lt;clang::driver::CC1Command::Execute(llvm::ArrayRef&lt;std::optional&lt;llvm::StringRef&gt;&gt;, std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt;&gt;*, bool*) const::'lambda'()&gt;(long) Job.cpp:0:0
#<!-- -->36 0x0000000003b4d224 llvm::CrashRecoveryContext::RunSafely(llvm::function_ref&lt;void ()&gt;) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x3b4d224)
#<!-- -->37 0x00000000045c717f clang::driver::CC1Command::Execute(llvm::ArrayRef&lt;std::optional&lt;llvm::StringRef&gt;&gt;, std::__cxx11::basic_string&lt;char, std::char_traits&lt;char&gt;, std::allocator&lt;char&gt;&gt;*, bool*) const (.part.0) Job.cpp:0:0
#<!-- -->38 0x000000000458d41d clang::driver::Compilation::ExecuteCommand(clang::driver::Command const&amp;, clang::driver::Command const*&amp;, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x458d41d)
#<!-- -->39 0x000000000458e50d clang::driver::Compilation::ExecuteJobs(clang::driver::JobList const&amp;, llvm::SmallVectorImpl&lt;std::pair&lt;int, clang::driver::Command const*&gt;&gt;&amp;, bool) const (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x458e50d)
#<!-- -->40 0x00000000045958c5 clang::driver::Driver::ExecuteCompilation(clang::driver::Compilation&amp;, llvm::SmallVectorImpl&lt;std::pair&lt;int, clang::driver::Command const*&gt;&gt;&amp;) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0x45958c5)
#<!-- -->41 0x0000000000cae123 clang_main(int, char**, llvm::ToolContext const&amp;) (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0xcae123)
#<!-- -->42 0x0000000000b82494 main (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0xb82494)
#<!-- -->43 0x00007dabed229d90 (/lib/x86_64-linux-gnu/libc.so.6+0x29d90)
#<!-- -->44 0x00007dabed229e40 __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x29e40)
#<!-- -->45 0x0000000000ca892e _start (/opt/compiler-explorer/clang-assertions-trunk/bin/clang+0xca892e)

@RKSimon RKSimon self-assigned this Dec 6, 2024
@RKSimon
Copy link
Collaborator

RKSimon commented Dec 6, 2024

Reduced:

define void @PR118934(i1 %b, ptr %f, ptr %k) {
entry:
  %0 = select i1 %b, i8 0, i8 -2
  br label %for.end

for.end:
  %n.i.i = select i1 poison, i32 6, i32 7
  %narrow = add nsw i8 %0, -6
  %add2.i = sext i8 %narrow to i32
  %conv5.i = add nsw i32 %n.i.i, %add2.i
  store i32 %conv5.i, ptr %f, align 4
  %add = shl nsw i32 %conv5.i, 1
  store i32 %add, ptr %k, align 4
  unreachable
}

@RKSimon RKSimon closed this as completed in 1885886 Dec 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants