[llvm-bugs] [Bug 26094] New: clang crashes at -O2 and above on x86_64-linux-gnu

via llvm-bugs llvm-bugs at lists.llvm.org
Fri Jan 8 18:29:57 PST 2016


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

            Bug ID: 26094
           Summary: clang crashes at -O2 and above on x86_64-linux-gnu
           Product: clang
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: LLVM Codegen
          Assignee: unassignedclangbugs at nondot.org
          Reporter: helloqirun at gmail.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

The current clang trunk crashes when compiling the following test case on
x86_64-linux-gnu in both 32-bit and 64-bit modes. 


$ clang-trunk -v
clang version 3.8.0 (trunk 257159)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.7.3
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.4
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.1
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 -O2 abc.c
abc.c:23:10: warning: too many arguments in call to 'fn3'
  fn3(fn2);
  ~~~    ^
clang: /home/absozero/trunk/llvm/include/llvm/Analysis/CallGraph.h:183:
llvm::CallGraphNode::~CallGraphNode(): Assertion `NumReferences == 0 && "Node
deleted while references remain"' failed.
#0 0x000000000304f3e8 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/home/absozero/trunk/root-clang/bin/clang+0x304f3e8)
#1 0x000000000304fb57 (/home/absozero/trunk/root-clang/bin/clang+0x304fb57)
#2 0x00007f3eba380340 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x10340)
#3 0x00007f3eb9394cc9 gsignal
/build/buildd/eglibc-2.19/signal/../nptl/sysdeps/unix/sysv/linux/raise.c:56:0
#4 0x00007f3eb93980d8 abort /build/buildd/eglibc-2.19/stdlib/abort.c:91:0
#5 0x00007f3eb938db86 __assert_fail_base
/build/buildd/eglibc-2.19/assert/assert.c:92:0
#6 0x00007f3eb938dc32 (/lib/x86_64-linux-gnu/libc.so.6+0x2fc32)
#7 0x0000000002c03ecf (/home/absozero/trunk/root-clang/bin/clang+0x2c03ecf)
#8 0x0000000002c06182 std::_Rb_tree<llvm::Function const*,
std::pair<llvm::Function const* const, std::unique_ptr<llvm::CallGraphNode,
std::default_delete<llvm::CallGraphNode> > >,
std::_Select1st<std::pair<llvm::Function const* const,
std::unique_ptr<llvm::CallGraphNode, std::default_delete<llvm::CallGraphNode> >
> >, std::less<llvm::Function const*>, std::allocator<std::pair<llvm::Function
const* const, std::unique_ptr<llvm::CallGraphNode,
std::default_delete<llvm::CallGraphNode> > > > >::erase(llvm::Function const*
const&) (/home/absozero/trunk/root-clang/bin/clang+0x2c06182)
#9 0x0000000002c04b76
llvm::CallGraph::removeFunctionFromModule(llvm::CallGraphNode*)
(/home/absozero/trunk/root-clang/bin/clang+0x2c04b76)
#10 0x0000000001aede2e llvm::Inliner::removeDeadFunctions(llvm::CallGraph&,
bool) (/home/absozero/trunk/root-clang/bin/clang+0x1aede2e)
#11 0x0000000002c07836 (/home/absozero/trunk/root-clang/bin/clang+0x2c07836)
#12 0x0000000002f957e5 llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/home/absozero/trunk/root-clang/bin/clang+0x2f957e5)
#13 0x0000000000a0c3c3 clang::EmitBackendOutput(clang::DiagnosticsEngine&,
clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions
const&, llvm::StringRef, llvm::Module*, clang::BackendAction,
llvm::raw_pwrite_stream*, std::unique_ptr<llvm::FunctionInfoIndex,
std::default_delete<llvm::FunctionInfoIndex> >)
(/home/absozero/trunk/root-clang/bin/clang+0xa0c3c3)
#14 0x00000000009ecadb (/home/absozero/trunk/root-clang/bin/clang+0x9ecadb)
#15 0x0000000000ca1056 clang::ParseAST(clang::Sema&, bool, bool)
(/home/absozero/trunk/root-clang/bin/clang+0xca1056)
#16 0x000000000077f905 clang::FrontendAction::Execute()
(/home/absozero/trunk/root-clang/bin/clang+0x77f905)
#17 0x00000000007477f1
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/home/absozero/trunk/root-clang/bin/clang+0x7477f1)
#18 0x000000000072630c
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/home/absozero/trunk/root-clang/bin/clang+0x72630c)
#19 0x000000000071c1c8 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/home/absozero/trunk/root-clang/bin/clang+0x71c1c8)
#20 0x00000000007249b3 main
(/home/absozero/trunk/root-clang/bin/clang+0x7249b3)
#21 0x00007f3eb937fec5 __libc_start_main
/build/buildd/eglibc-2.19/csu/libc-start.c:321:0
#22 0x000000000071bc64 _start
(/home/absozero/trunk/root-clang/bin/clang+0x71bc64)
Stack dump:
0.    Program arguments: /home/absozero/trunk/root-clang/bin/clang -cc1 -triple
x86_64-unknown-linux-gnu -emit-obj -disable-free -main-file-name abc.c
-mrelocation-model static -mthread-model posix -fmath-errno -masm-verbose
-mconstructor-aliases -munwind-tables -fuse-init-array -target-cpu x86-64
-target-linker-version 2.24 -momit-leaf-frame-pointer -dwarf-column-info
-debugger-tuning=gdb -resource-dir
/home/absozero/trunk/root-clang/bin/../lib/clang/3.8.0 -c-isystem
/usr/local/include/csmith-2.3.0 -c-isystem . -cxx-isystem
/usr/local/include/csmith-2.3.0 -cxx-isystem . -internal-isystem
/usr/local/include -internal-isystem
/home/absozero/trunk/root-clang/bin/../lib/clang/3.8.0/include
-internal-externc-isystem /usr/include/x86_64-linux-gnu
-internal-externc-isystem /include -internal-externc-isystem /usr/include -O2
-fdebug-compilation-dir /home/absozero/projects/reduction -ferror-limit 19
-fmessage-length 142 -fobjc-runtime=gcc -fdiagnostics-show-option
-fcolor-diagnostics -vectorize-loops -vectorize-slp -o /tmp/abc-e928cb.o -x c
abc.c 
1.    <eof> parser at end of file
2.    Per-module optimization passes
3.    Running pass 'CallGraph Pass Manager' on module 'abc.c'.
clang: error: unable to execute command: Aborted (core dumped)
clang: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 3.8.0 (trunk 257159)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/bin
clang: 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: note: diagnostic msg: 
********************

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

********************



-------------------------
$ cat abc.c
#include "stdio.h"


int a=0,b=0;
int fn1(int);

static void fn2() {
  fn1(5);
  fn1(b >> 1);
  fn1(b >> 1 & 1);
  fn1(b >> 1 & 1);
  fn1(b >> 1 & 1);
  if (b)
    printf("1");
}

void fn3() {
  a = 0;
  for (; a < 1;){}

}
int main() {
  fn3(fn2);
  fn2();
  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/20160109/46727597/attachment.html>


More information about the llvm-bugs mailing list