<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 -licm -instcombine -gvn -correlated-propagation -loop-deletion -adce""
   href="https://bugs.llvm.org/show_bug.cgi?id=40431">40431</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>opt crashes with "opt -licm -instcombine -gvn -correlated-propagation -loop-deletion -adce"
          </td>
        </tr>

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

        <tr>
          <th>Version</th>
          <td>6.0
          </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=21372" name="attach_21372" title=".bc file of the source code">attachment 21372</a> <a href="attachment.cgi?id=21372&action=edit" title=".bc file of the source code">[details]</a></span>
.bc file of the source code

$ clang -v
clang version 6.0.0 (tags/RELEASE_600/final)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir:
/home/jack-zhou/clang+llvm-6.0.0-x86_64-linux-gnu-ubuntu-16.04/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
-I'path of csmith's runtime'
$ opt -licm -instcombine -gvn -correlated-propagation -loop-deletion -adce 
small.bc -o small-opt.bc
LLVMSymbolizer: error reading file: No such file or directory
#0 0x0000000001a68794 (opt+0x1a68794)
#1 0x0000000001a68a76 (opt+0x1a68a76)
#2 0x00007fabb7def890 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x12890)
#3 0x000000000185b5d1 (opt+0x185b5d1)
#4 0x0000000001859bd6 (opt+0x1859bd6)
#5 0x000000000185c840 (opt+0x185c840)
#6 0x00000000016021eb (opt+0x16021eb)
#7 0x0000000001602453 (opt+0x1602453)
#8 0x0000000001602858 (opt+0x1602858)
#9 0x000000000075b292 (opt+0x75b292)
#10 0x00007fabb6cc2b97 __libc_start_main
(/lib/x86_64-linux-gnu/libc.so.6+0x21b97)
#11 0x000000000074c1b9 (opt+0x74c1b9)
Stack dump:
0.      Program arguments: opt -licm -instcombine -gvn -correlated-propagation
-loop-deletion -adce small.bc -o small-opt.bc 
1.      Running pass 'Function Pass Manager' on module 'small.bc'.
2.      Running pass 'Aggressive Dead Code Elimination' on function '@e'
Segmentation fault (core dumped)

The following is the source code of small.c, which is generated by csmith and
reduced by creduce.
#include "csmith.h"
a, b, c;
*d;
e() {
  uint32_t f;
  int32_t g = 3;
  int32_t h;
  uint32_t i;
  int16_t j[9];
  for (;;) {
    uint32_t k[] = {f, b, 0, c, b, b, 0, f, f, b, c, c, 0};
    if (j > i)
      ;
    else {
      if (g)
        break;
      for (; a;) {
        int32_t l;
        if ((h = *d) | l)
          ;
        else
          break;
      }
    }
  }
}</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>