[llvm-bugs] [Bug 40932] New: opt crashes with "opt -inline -consthoist"

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Mar 2 01:27:15 PST 2019


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

            Bug ID: 40932
           Summary: opt crashes with "opt -inline -consthoist"
           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 21545
  --> https://bugs.llvm.org/attachment.cgi?id=21545&action=edit
.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 -inline -consthoist small.bc -o small-opt.bc
Stack dump:
0.      Program arguments:
/home/jack-zhou/Documents/llvm/llvm_truck/llvm/build2/bin/opt -inline
-consthoist small.bc -o small-opt.bc 
1.      Running pass 'CallGraph Pass Manager' on module 'small.bc'.
2.      Running pass 'Constant Hoisting' on function '@d'
 #0 0x000055abb4f99b7b llvm::sys::PrintStackTrace(llvm::raw_ostream&)
/home/jack-zhou/Documents/llvm/llvm_truck/llvm/lib/Support/Unix/Signals.inc:494:0
 #1 0x000055abb4f99c0e PrintStackTraceSignalHandler(void*)
/home/jack-zhou/Documents/llvm/llvm_truck/llvm/lib/Support/Unix/Signals.inc:558:0
 #2 0x000055abb4f97b92 llvm::sys::RunSignalHandlers()
/home/jack-zhou/Documents/llvm/llvm_truck/llvm/lib/Support/Signals.cpp:68:0
 #3 0x000055abb4f9959d SignalHandler(int)
/home/jack-zhou/Documents/llvm/llvm_truck/llvm/lib/Support/Unix/Signals.inc:357:0
 #4 0x00007fa341a2d890 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x12890)
 #5 0x000055abb4690da2 llvm::DomTreeNodeBase<llvm::BasicBlock>::getIDom() const
/home/jack-zhou/Documents/llvm/llvm_truck/llvm/include/llvm/Support/GenericDomTree.h:82:0
 #6 0x000055abb4c0ba5e 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 0x000055abb4c0c400
llvm::ConstantHoistingPass::findConstantInsertionPoint(llvm::consthoist::ConstantInfo
const&) const
/home/jack-zhou/Documents/llvm/llvm_truck/llvm/lib/Transforms/Scalar/ConstantHoisting.cpp:319:0
 #8 0x000055abb4c0ef1e
llvm::ConstantHoistingPass::emitBaseConstants(llvm::GlobalVariable*)
/home/jack-zhou/Documents/llvm/llvm_truck/llvm/lib/Transforms/Scalar/ConstantHoisting.cpp:826:0
 #9 0x000055abb4c0fa17 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 0x000055abb4c0b5b7 (anonymous
namespace)::ConstantHoistingLegacyPass::runOnFunction(llvm::Function&)
/home/jack-zhou/Documents/llvm/llvm_truck/llvm/lib/Transforms/Scalar/ConstantHoisting.cpp:153:0
#11 0x000055abb471a1fc llvm::FPPassManager::runOnFunction(llvm::Function&)
/home/jack-zhou/Documents/llvm/llvm_truck/llvm/lib/IR/LegacyPassManager.cpp:1643:0
#12 0x000055abb3db9e33 (anonymous
namespace)::CGPassManager::RunPassOnSCC(llvm::Pass*, llvm::CallGraphSCC&,
llvm::CallGraph&, bool&, bool&)
/home/jack-zhou/Documents/llvm/llvm_truck/llvm/lib/Analysis/CallGraphSCCPass.cpp:177:0
#13 0x000055abb3dbae4d (anonymous
namespace)::CGPassManager::RunAllPassesOnSCC(llvm::CallGraphSCC&,
llvm::CallGraph&, bool&)
/home/jack-zhou/Documents/llvm/llvm_truck/llvm/lib/Analysis/CallGraphSCCPass.cpp:441:0
#14 0x000055abb3dbb19a (anonymous
namespace)::CGPassManager::runOnModule(llvm::Module&)
/home/jack-zhou/Documents/llvm/llvm_truck/llvm/lib/Analysis/CallGraphSCCPass.cpp:497:0
#15 0x000055abb471a844 (anonymous
namespace)::MPPassManager::runOnModule(llvm::Module&)
/home/jack-zhou/Documents/llvm/llvm_truck/llvm/lib/IR/LegacyPassManager.cpp:1743:0
#16 0x000055abb471afd3 llvm::legacy::PassManagerImpl::run(llvm::Module&)
/home/jack-zhou/Documents/llvm/llvm_truck/llvm/lib/IR/LegacyPassManager.cpp:1856:0
#17 0x000055abb471b1c5 llvm::legacy::PassManager::run(llvm::Module&)
/home/jack-zhou/Documents/llvm/llvm_truck/llvm/lib/IR/LegacyPassManager.cpp:1888:0
#18 0x000055abb297815f main
/home/jack-zhou/Documents/llvm/llvm_truck/llvm/tools/opt/opt.cpp:862:0
#19 0x00007fa3406c2b97 __libc_start_main
/build/glibc-OTsEL5/glibc-2.27/csu/../csu/libc-start.c:344:0
#20 0x000055abb2939cba _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;
b() {
  for (;;)
    c(4294967288);
}
d() {
  b();
  transparent_crc(a, "", d);
}

-- 
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/20190302/d77e296e/attachment.html>


More information about the llvm-bugs mailing list