<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - opt crashes with "opt -mem2reg -jump-threading -consthoist""
   href="https://bugs.llvm.org/show_bug.cgi?id=40934">40934</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>opt crashes with "opt -mem2reg -jump-threading -consthoist"
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libraries
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>Scalar Optimizations
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>cszide@163.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=21547" name="attach_21547" title=".bc file of the source code">attachment 21547</a> <a href="attachment.cgi?id=21547&action=edit" title=".bc file of the source code">[details]</a></span>
.bc file of the source code

$clang -v
clang version 9.0.0 (trunk 354742)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/jack-zhou/Documents/llvm/llvm_truck/llvm/build/bin
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.5.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6.5.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7.3.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/8
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7.3.0
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@mx32
Selected multilib: .;@m64

$clang -O3 -c -emit-llvm  -mllvm -disable-llvm-optzns small.c -o small.bc

$opt -mem2reg -jump-threading -consthoist  small.bc -o small-opt.bc
Stack dump:
0.      Program arguments:
/home/jack-zhou/Documents/llvm/llvm_truck/llvm/build2/bin/opt -mem2reg
-jump-threading -consthoist small.bc -o small-opt.bc 
1.      Running pass 'Function Pass Manager' on module 'small.bc'.
2.      Running pass 'Constant Hoisting' on function '@a'
 #0 0x0000561f1d925b7b llvm::sys::PrintStackTrace(llvm::raw_ostream&)
/home/jack-zhou/Documents/llvm/llvm_truck/llvm/lib/Support/Unix/Signals.inc:494:0
 #1 0x0000561f1d925c0e PrintStackTraceSignalHandler(void*)
/home/jack-zhou/Documents/llvm/llvm_truck/llvm/lib/Support/Unix/Signals.inc:558:0
 #2 0x0000561f1d923b92 llvm::sys::RunSignalHandlers()
/home/jack-zhou/Documents/llvm/llvm_truck/llvm/lib/Support/Signals.cpp:68:0
 #3 0x0000561f1d92559d SignalHandler(int)
/home/jack-zhou/Documents/llvm/llvm_truck/llvm/lib/Support/Unix/Signals.inc:357:0
 #4 0x00007f04bdb89890 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x12890)
 #5 0x0000561f1d01cda2 llvm::DomTreeNodeBase<llvm::BasicBlock>::getIDom() const
/home/jack-zhou/Documents/llvm/llvm_truck/llvm/include/llvm/Support/GenericDomTree.h:82:0
 #6 0x0000561f1d597a5e findBestInsertionSet(llvm::DominatorTree&,
llvm::BlockFrequencyInfo&, llvm::BasicBlock*,
llvm::SmallPtrSet<llvm::BasicBlock*, 8u>&)
/home/jack-zhou/Documents/llvm/llvm_truck/llvm/lib/Transforms/Scalar/ConstantHoisting.cpp:225:0
 #7 0x0000561f1d598400
llvm::ConstantHoistingPass::findConstantInsertionPoint(llvm::consthoist::ConstantInfo
const&) const
/home/jack-zhou/Documents/llvm/llvm_truck/llvm/lib/Transforms/Scalar/ConstantHoisting.cpp:319:0
 #8 0x0000561f1d59af1e
llvm::ConstantHoistingPass::emitBaseConstants(llvm::GlobalVariable*)
/home/jack-zhou/Documents/llvm/llvm_truck/llvm/lib/Transforms/Scalar/ConstantHoisting.cpp:826:0
 #9 0x0000561f1d59ba17 llvm::ConstantHoistingPass::runImpl(llvm::Function&,
llvm::TargetTransformInfo&, llvm::DominatorTree&, llvm::BlockFrequencyInfo*,
llvm::BasicBlock&)
/home/jack-zhou/Documents/llvm/llvm_truck/llvm/lib/Transforms/Scalar/ConstantHoisting.cpp:941:0
#10 0x0000561f1d5975b7 (anonymous
namespace)::ConstantHoistingLegacyPass::runOnFunction(llvm::Function&)
/home/jack-zhou/Documents/llvm/llvm_truck/llvm/lib/Transforms/Scalar/ConstantHoisting.cpp:153:0
#11 0x0000561f1d0a61fc llvm::FPPassManager::runOnFunction(llvm::Function&)
/home/jack-zhou/Documents/llvm/llvm_truck/llvm/lib/IR/LegacyPassManager.cpp:1643:0
#12 0x0000561f1d0a6473 llvm::FPPassManager::runOnModule(llvm::Module&)
/home/jack-zhou/Documents/llvm/llvm_truck/llvm/lib/IR/LegacyPassManager.cpp:1678:0
#13 0x0000561f1d0a6844 (anonymous
namespace)::MPPassManager::runOnModule(llvm::Module&)
/home/jack-zhou/Documents/llvm/llvm_truck/llvm/lib/IR/LegacyPassManager.cpp:1743:0
#14 0x0000561f1d0a6fd3 llvm::legacy::PassManagerImpl::run(llvm::Module&)
/home/jack-zhou/Documents/llvm/llvm_truck/llvm/lib/IR/LegacyPassManager.cpp:1856:0
#15 0x0000561f1d0a71c5 llvm::legacy::PassManager::run(llvm::Module&)
/home/jack-zhou/Documents/llvm/llvm_truck/llvm/lib/IR/LegacyPassManager.cpp:1888:0
#16 0x0000561f1b30415f main
/home/jack-zhou/Documents/llvm/llvm_truck/llvm/tools/opt/opt.cpp:862:0
#17 0x00007f04bc81eb97 __libc_start_main
/build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:344:0
#18 0x0000561f1b2c5cba _start
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm/build2/bin/opt+0x1808cba)
Segmentation fault (core dumped)

The following is the source code of small.c, which is generated by csmith 2.4.0
and reduced by creduce 2.9.0 (eca4f38).

#include "csmith.h"
a() {
  uint64_t b = 7788015061;
  for (; 0;) {
    uint64_t c;
    for (;;)
      c &= (d(b), b);
  }
}</pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>