[llvm-bugs] [Bug 26096] New: clang crashes at -O3 on x86_64-linux-gnu

via llvm-bugs llvm-bugs at lists.llvm.org
Sat Jan 9 09:00:21 PST 2016


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

            Bug ID: 26096
           Summary: clang crashes at -O3 on x86_64-linux-gnu
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: normal
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: su at cs.ucdavis.edu
                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 at -O3 in both 32-bit and 64-bit modes. 

It also affects 3.5.x, 3.6.x and 3.7.x, making it a regression from 3.4.x. 


$ clang-trunk -v
clang version 3.8.0 (trunk 257184)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/tools/bin
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.9
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/4.9.3
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/5.2.1
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.4
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.4.7
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.6.4
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.3
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.2.1
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/4.9
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@mx32
Selected multilib: .;@m64
$ 
$ clang-trunk -O2 -c small.c
$ clang-3.4 -O3 -c small.c
$ 
$ clang-trunk -O3 -c small.c
clang: /tmp/llvm/include/llvm/Analysis/CallGraph.h:183:
llvm::CallGraphNode::~CallGraphNode(): Assertion `NumReferences == 0 && "Node
deleted while references remain"' failed.
#0 0x0000000002f45075 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/usr/local/clang-trunk/bin/clang+0x2f45075)
#1 0x0000000002f42e26 llvm::sys::RunSignalHandlers()
(/usr/local/clang-trunk/bin/clang+0x2f42e26)
#2 0x0000000002f43051 (/usr/local/clang-trunk/bin/clang+0x2f43051)
#3 0x00007fc7c7e00340 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x10340)
#4 0x00007fc7c6e0acc9 gsignal
/build/buildd/eglibc-2.19/signal/../nptl/sysdeps/unix/sysv/linux/raise.c:56:0
#5 0x00007fc7c6e0e0d8 abort /build/buildd/eglibc-2.19/stdlib/abort.c:91:0
#6 0x00007fc7c6e03b86 __assert_fail_base
/build/buildd/eglibc-2.19/assert/assert.c:92:0
#7 0x00007fc7c6e03c32 (/lib/x86_64-linux-gnu/libc.so.6+0x2fc32)
#8 0x0000000002b5f89f (/usr/local/clang-trunk/bin/clang+0x2b5f89f)
#9 0x0000000001b0ba4b llvm::Inliner::removeDeadFunctions(llvm::CallGraph&,
bool) (/usr/local/clang-trunk/bin/clang+0x1b0ba4b)
#10 0x0000000002b64499 (/usr/local/clang-trunk/bin/clang+0x2b64499)
#11 0x0000000002ebf33f llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/usr/local/clang-trunk/bin/clang+0x2ebf33f)
#12 0x0000000000bf7dea clang::EmitBackendOutput(clang::DiagnosticsEngine&,
clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions
const&, llvm::StringRef, llvm::Module*, clang::BackendAction,
llvm::raw_pwrite_stream*) (/usr/local/clang-trunk/bin/clang+0xbf7dea)
#13 0x0000000000bd3d03 (/usr/local/clang-trunk/bin/clang+0xbd3d03)
#14 0x0000000000e0e34b clang::ParseAST(clang::Sema&, bool, bool)
(/usr/local/clang-trunk/bin/clang+0xe0e34b)
#15 0x0000000000bd3dee clang::CodeGenAction::ExecuteAction()
(/usr/local/clang-trunk/bin/clang+0xbd3dee)
#16 0x00000000009ef226 clang::FrontendAction::Execute()
(/usr/local/clang-trunk/bin/clang+0x9ef226)
#17 0x00000000009c868e
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/usr/local/clang-trunk/bin/clang+0x9c868e)
#18 0x00000000009ad4da
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/usr/local/clang-trunk/bin/clang+0x9ad4da)
#19 0x00000000009a4e98 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/usr/local/clang-trunk/bin/clang+0x9a4e98)
#20 0x0000000000965b2a main (/usr/local/clang-trunk/bin/clang+0x965b2a)
#21 0x00007fc7c6df5ec5 __libc_start_main
/build/buildd/eglibc-2.19/csu/libc-start.c:321:0
#22 0x00000000009a350d _start (/usr/local/clang-trunk/bin/clang+0x9a350d)
Stack dump:
0.    Program arguments: /usr/local/clang-trunk/bin/clang -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
-target-linker-version 2.24 -momit-leaf-frame-pointer -dwarf-column-info
-debugger-tuning=gdb -coverage-file /data2/small.c -resource-dir
/usr/local/clang-trunk/bin/../lib/clang/3.8.0 -internal-isystem
/usr/local/include -internal-isystem
/usr/local/clang-trunk/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 -O3 -fdebug-compilation-dir /data2
-ferror-limit 19 -fmessage-length 114 -fobjc-runtime=gcc
-fdiagnostics-show-option -fcolor-diagnostics -vectorize-loops -vectorize-slp
-o small.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'.
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 257184)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/tools/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/small-30c18f.c
clang: note: diagnostic msg: /tmp/small-30c18f.sh
clang: note: diagnostic msg: 

********************
$ 


-------------------------------------------------------------


int a, b, *c, *d;
static int **e = &d, **f = &c;

void __assert_fail (char *) __attribute__ ((__noreturn__));

static int
fn1 ()
{
  b = 1;
  for (; b;)
    {
      int g;
      c ? (void) 0 : __assert_fail (0);
      *f = &g;
      *e == &g ? (void) 0 : __assert_fail (0);
      **f & b ? (void) 0 : __assert_fail (0);
    }
  return 0;
}

static int
fn2 ()
{
  int *h, **i = &h;
  fn1 ();
  fn1 ();
  fn1 ();
  **i = 0;
  return 0;
}

void
fn3 ()
{
  if (a)
    fn2 ();
  fn2 ();
}

-- 
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/91b5a029/attachment.html>


More information about the llvm-bugs mailing list