[llvm-bugs] [Bug 42016] New: opt crashes with "opt -early-cse -indvars -sroa -lowerswitch -loop-unswitch -licm -loop-extract-single -inline"

via llvm-bugs llvm-bugs at lists.llvm.org
Sat May 25 04:27:09 PDT 2019


https://bugs.llvm.org/show_bug.cgi?id=42016

            Bug ID: 42016
           Summary: opt crashes with "opt -early-cse -indvars -sroa
                    -lowerswitch -loop-unswitch -licm -loop-extract-single
                    -inline"
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: cszide at 163.com
                CC: llvm-bugs at lists.llvm.org

Created attachment 22017
  --> https://bugs.llvm.org/attachment.cgi?id=22017&action=edit
.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;
  }
}

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20190525/bb2ac1fa/attachment-0001.html>


More information about the llvm-bugs mailing list