<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 -early-cse -indvars -sroa -lowerswitch -loop-unswitch -licm -loop-extract-single -inline""
   href="https://bugs.llvm.org/show_bug.cgi?id=42016">42016</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>opt crashes with "opt -early-cse -indvars -sroa -lowerswitch -loop-unswitch -licm -loop-extract-single -inline"
          </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=22017" name="attach_22017" title=".bc file of the source code">attachment 22017</a> <a href="attachment.cgi?id=22017&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 355281)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /home/jack-zhou/Documents/llvm/llvm_truck/llvm/build4/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.4.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/8
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/7.4.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

$opt -early-cse -indvars -sroa -lowerswitch -loop-unswitch -licm 
-loop-extract-single  -inline  small.bc -o small-opt.bc
Instruction does not dominate all uses!
  <badref> = alloca [5 x i64], *** stack smashing detected ***: <unknown>
terminated
Stack dump:
0.      Program arguments:
/home/jack-zhou/Documents/llvm/llvm_truck/llvm/build4/bin/opt -early-cse
-indvars -sroa -lowerswitch -loop-unswitch -licm -loop-extract-single -inline
small.bc -o small-opt.bc 
1.      Running pass 'CallGraph Pass Manager' on module 'small.bc'.
2.      Running pass 'Module Verifier' on function '@fn1'
 #0 0x000055b2535e3d2a llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm/build4/bin/opt+0x20d9d2a)
 #1 0x000055b2535e1d04 llvm::sys::RunSignalHandlers()
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm/build4/bin/opt+0x20d7d04)
 #2 0x000055b2535e1e42 SignalHandler(int)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm/build4/bin/opt+0x20d7e42)
 #3 0x00007f974ba5b890 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x12890)
 #4 0x00007f974a70de97 gsignal
/build/glibc-OTsEL5/glibc-2.27/signal/../sysdeps/unix/sysv/linux/raise.c:51:0
 #5 0x00007f974a70f801 abort /build/glibc-OTsEL5/glibc-2.27/stdlib/abort.c:81:0
 #6 0x00007f974a758897 __libc_message
/build/glibc-OTsEL5/glibc-2.27/libio/../sysdeps/posix/libc_fatal.c:181:0
 #7 0x00007f974a803cd1 __GI___fortify_fail_abort
/build/glibc-OTsEL5/glibc-2.27/debug/fortify_fail.c:33:0
 #8 0x00007f974a803c92 (/lib/x86_64-linux-gnu/libc.so.6+0x134c92)
 #9 0x000055b252ec8948
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm/build4/bin/opt+0x19be948)
#10 0x000055b252ecd071 (anonymous
namespace)::AssemblyWriter::writeOperand(llvm::Value const*, bool)
(.constprop.1019)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm/build4/bin/opt+0x19c3071)
#11 0x000055b252ed258f (anonymous
namespace)::AssemblyWriter::printInstruction(llvm::Instruction const&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm/build4/bin/opt+0x19c858f)
#12 0x000055b252ed5991 llvm::Value::print(llvm::raw_ostream&,
llvm::ModuleSlotTracker&, bool) const
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm/build4/bin/opt+0x19cb991)
#13 0x000055b252ff587b llvm::VerifierSupport::Write(llvm::Value const&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm/build4/bin/opt+0x1aeb87b)
#14 0x000055b2530076ca (anonymous
namespace)::Verifier::visitInstruction(llvm::Instruction&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm/build4/bin/opt+0x1afd6ca)
#15 0x000055b25300f1a6 (anonymous namespace)::Verifier::verify(llvm::Function
const&) (.part.1280)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm/build4/bin/opt+0x1b051a6)
#16 0x000055b253012355 (anonymous
namespace)::VerifierLegacyPass::runOnFunction(llvm::Function&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm/build4/bin/opt+0x1b08355)
#17 0x000055b252f9d7a9 llvm::FPPassManager::runOnFunction(llvm::Function&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm/build4/bin/opt+0x1a937a9)
#18 0x000055b25294a570 (anonymous
namespace)::CGPassManager::runOnModule(llvm::Module&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm/build4/bin/opt+0x1440570)
#19 0x000055b252f9cb59 llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm/build4/bin/opt+0x1a92b59)
#20 0x000055b251b3a153 main
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm/build4/bin/opt+0x630153)
#21 0x00007f974a6f0b97 __libc_start_main
/build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:344:0
#22 0x000055b251bcef6a _start
(/home/jack-zhou/Documents/llvm/llvm_truck/llvm/build4/bin/opt+0x6c4f6a)
Aborted (core dumped)

-----------------------------------------
struct a {
  signed e;
} c;
int b, d;
int *fn1(signed char f, struct a p) {
  int g=0;
l:
  for (; f;) {
    int i=0;
    for (; 0; 0)
      ;
    if (p.e)
      break;
    for (; 0; 1) {
      long int h[5];
      for (; 5; g++)
        h[g] = d;
    }
  }
  {
    int k=0;
    if (b)
      goto l;
  }
}</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>