[llvm-bugs] [Bug 33114] New: crash at -O3 on x86_64-linux-gnu in both 32-bit and 64-bit modes. (llvm::Value* llvm::PHINode::getOperand(unsigned int) const: Assertion `i_nocapture < OperandTraits<PHINode>::operands(this) && "getOperand() out of range!"' failed)

via llvm-bugs llvm-bugs at lists.llvm.org
Sat May 20 16:10:41 PDT 2017


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

            Bug ID: 33114
           Summary: crash at -O3 on x86_64-linux-gnu in both 32-bit and
                    64-bit modes. (llvm::Value*
                    llvm::PHINode::getOperand(unsigned int) const:
                    Assertion `i_nocapture <
                    OperandTraits<PHINode>::operands(this) &&
                    "getOperand() out of range!"' failed)
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: chengniansun at gmail.com
                CC: llvm-bugs at lists.llvm.org

$ clang-trunk -v
clang version 5.0.0 (trunk 303430)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/5
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/5.3.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8.5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9.2
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.3.0
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.8
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@mx32
Selected multilib: .;@m64
$ 
$ clang-trunk -O3 small.c
clang-5.0:
/tmp/llvm-builder/llvm-source-trunk/include/llvm/IR/Instructions.h:2775:
llvm::Value* llvm::PHINode::getOperand(unsigned int) const: Assertion
`i_nocapture < OperandTraits<PHINode>::operands(this) && "getOperand() out of
range!"' failed.
#0 0x000000000219a86a llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/usr/local/clang-trunk/bin/clang-5.0+0x219a86a)
#1 0x000000000219887e llvm::sys::RunSignalHandlers()
(/usr/local/clang-trunk/bin/clang-5.0+0x219887e)
#2 0x00000000021989e2 SignalHandler(int)
(/usr/local/clang-trunk/bin/clang-5.0+0x21989e2)
#3 0x00007fb7a1377330 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x10330)
#4 0x00007fb7a0165c37 gsignal
/build/eglibc-MjiXCM/eglibc-2.19/signal/../nptl/sysdeps/unix/sysv/linux/raise.c:56:0
#5 0x00007fb7a0169028 abort
/build/eglibc-MjiXCM/eglibc-2.19/stdlib/abort.c:91:0
#6 0x00007fb7a015ebf6 __assert_fail_base
/build/eglibc-MjiXCM/eglibc-2.19/assert/assert.c:92:0
#7 0x00007fb7a015eca2 (/lib/x86_64-linux-gnu/libc.so.6+0x2fca2)
#8 0x000000000186467f (/usr/local/clang-trunk/bin/clang-5.0+0x186467f)
#9 0x00000000020331f2 (anonymous
namespace)::LoopIdiomRecognize::recognizeAndInsertCTLZ()
(/usr/local/clang-trunk/bin/clang-5.0+0x20331f2)
#10 0x000000000203793e (anonymous
namespace)::LoopIdiomRecognize::runOnLoop(llvm::Loop*)
(/usr/local/clang-trunk/bin/clang-5.0+0x203793e)
#11 0x0000000002038ab8 (anonymous
namespace)::LoopIdiomRecognizeLegacyPass::runOnLoop(llvm::Loop*,
llvm::LPPassManager&) [clone .part.599]
(/usr/local/clang-trunk/bin/clang-5.0+0x2038ab8)
#12 0x0000000001906097 llvm::LPPassManager::runOnFunction(llvm::Function&)
(/usr/local/clang-trunk/bin/clang-5.0+0x1906097)
#13 0x0000000001d70063 llvm::FPPassManager::runOnFunction(llvm::Function&)
(/usr/local/clang-trunk/bin/clang-5.0+0x1d70063)
#14 0x0000000002b2339f (anonymous
namespace)::CGPassManager::runOnModule(llvm::Module&)
(/usr/local/clang-trunk/bin/clang-5.0+0x2b2339f)
#15 0x0000000001d70e6f llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/usr/local/clang-trunk/bin/clang-5.0+0x1d70e6f)
#16 0x000000000231efd3 (anonymous
namespace)::EmitAssemblyHelper::EmitAssembly(clang::BackendAction,
std::unique_ptr<llvm::raw_pwrite_stream,
std::default_delete<llvm::raw_pwrite_stream> >)
(/usr/local/clang-trunk/bin/clang-5.0+0x231efd3)
#17 0x0000000002320381 clang::EmitBackendOutput(clang::DiagnosticsEngine&,
clang::HeaderSearchOptions const&, clang::CodeGenOptions const&,
clang::TargetOptions const&, clang::LangOptions const&, llvm::DataLayout
const&, llvm::Module*, clang::BackendAction,
std::unique_ptr<llvm::raw_pwrite_stream,
std::default_delete<llvm::raw_pwrite_stream> >)
(/usr/local/clang-trunk/bin/clang-5.0+0x2320381)
#18 0x00000000029c1b3b
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
(/usr/local/clang-trunk/bin/clang-5.0+0x29c1b3b)
#19 0x0000000002da8882 clang::ParseAST(clang::Sema&, bool, bool)
(/usr/local/clang-trunk/bin/clang-5.0+0x2da8882)
#20 0x00000000029c120f clang::CodeGenAction::ExecuteAction()
(/usr/local/clang-trunk/bin/clang-5.0+0x29c120f)
#21 0x00000000026964c6 clang::FrontendAction::Execute()
(/usr/local/clang-trunk/bin/clang-5.0+0x26964c6)
#22 0x0000000002670156
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/usr/local/clang-trunk/bin/clang-5.0+0x2670156)
#23 0x0000000002720e14
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/usr/local/clang-trunk/bin/clang-5.0+0x2720e14)
#24 0x0000000000d22358 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/usr/local/clang-trunk/bin/clang-5.0+0xd22358)
#25 0x0000000000cc1703 main (/usr/local/clang-trunk/bin/clang-5.0+0xcc1703)
#26 0x00007fb7a0150f45 __libc_start_main
/build/eglibc-MjiXCM/eglibc-2.19/csu/libc-start.c:321:0
#27 0x0000000000d1dc79 _start (/usr/local/clang-trunk/bin/clang-5.0+0xd1dc79)
Stack dump:
0.      Program arguments: /usr/local/clang-trunk/bin/clang-5.0 -cc1 -triple
x86_64-unknown-linux-gnu -emit-obj -disable-free -main-file-name small.c
-mrelocation-model static -mthread-model posix -fmath-errno -masm-verbose
-mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64
-momit-leaf-frame-pointer -dwarf-column-info -debugger-tuning=gdb -resource-dir
/usr/local/clang-trunk/lib/clang/5.0.0 -c-isystem . -c-isystem
/usr/local/include/csmith-2.2.0/ -internal-isystem /usr/local/include
-internal-isystem /usr/local/clang-trunk/lib/clang/5.0.0/include
-internal-externc-isystem /usr/include/x86_64-linux-gnu
-internal-externc-isystem /include -internal-externc-isystem /usr/include -O3
-fdebug-compilation-dir
/home/cnsun/ramdisk/hermes/run-5/res/20170519-clang-trunk-m32-Weverything-g-O3-build-042752/delta
-ferror-limit 19 -fmessage-length 128 -fobjc-runtime=gcc
-fdiagnostics-show-option -fcolor-diagnostics -vectorize-loops -vectorize-slp
-o /tmp/small-f8ffa0.o -x c small.c 
1.      <eof> parser at end of file
2.      Per-module optimization passes
3.      Running pass 'CallGraph Pass Manager' on module 'small.c'.
4.      Running pass 'Loop Pass Manager' on function '@main'
5.      Running pass 'Recognize loop idioms' on basic block '%if.end'
clang-5.0: error: unable to execute command: Aborted (core dumped)
clang-5.0: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 5.0.0 (trunk 303430)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin
clang-5.0: note: diagnostic msg: PLEASE submit a bug report to
http://llvm.org/bugs/ and include the crash backtrace, preprocessed source, and
associated run script.
clang-5.0: note: diagnostic msg: 
********************

PLEASE ATTACH THE FOLLOWING FILES TO THE BUG REPORT:
Preprocessed source(s) and associated run script(s) are located at:
clang-5.0: note: diagnostic msg: /tmp/small-5685df.c
clang-5.0: note: diagnostic msg: /tmp/small-5685df.sh
clang-5.0: note: diagnostic msg: 

********************
$ 
$ cat small.c
int a, c;
long b;
int main() {
  int d;
L2:
  if (!c) {
    d = a;
    goto L2;
  }
  if (b) {
    c = a >> d % b;
    goto L2;
  }
  b = a = d;
  goto L2;
  return 0;
}
$

-- 
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/20170520/1912d351/attachment.html>


More information about the llvm-bugs mailing list