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

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Feb 7 22:37:11 PST 2016


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

            Bug ID: 26523
           Summary: clang crashes on valid code 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. 

This is a regression from 3.7.x.  


$ clang-trunk -v
clang version 3.9.0 (trunk 260022)
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.3.0
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.3.0
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.7 -O3 -c small.c
$ 
$ clang-trunk -O3 -c small.c
While deleting: i32 %land.ext.us
Use still stuck around after Def is destroyed:  %cond.lcssa = phi i32 [ %1,
%cond.end ], [ 0, %for.inc21.loopexit ], [ %land.ext.us, %for.inc21.loopexit127
], [ %1, %for.inc21.loopexit128 ], [ %1, %for.inc21.loopexit130 ]
clang-3.9: /tmp/llvm/lib/IR/Value.cpp:83: virtual llvm::Value::~Value():
Assertion `use_empty() && "Uses remain when a value is destroyed!"' failed.
#0 0x0000000002c9accd llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/usr/local/clang-trunk/bin/clang-3.9+0x2c9accd)
#1 0x0000000002c9afe2 PrintStackTraceSignalHandler(void*)
(/usr/local/clang-trunk/bin/clang-3.9+0x2c9afe2)
#2 0x0000000002c9962f llvm::sys::RunSignalHandlers()
(/usr/local/clang-trunk/bin/clang-3.9+0x2c9962f)
#3 0x0000000002c9a743 SignalHandler(int)
(/usr/local/clang-trunk/bin/clang-3.9+0x2c9a743)
#4 0x00007f723d3d7340 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x10340)
#5 0x00007f723c5f5cc9 gsignal
/build/buildd/eglibc-2.19/signal/../nptl/sysdeps/unix/sysv/linux/raise.c:56:0
#6 0x00007f723c5f90d8 abort /build/buildd/eglibc-2.19/stdlib/abort.c:91:0
#7 0x00007f723c5eeb86 __assert_fail_base
/build/buildd/eglibc-2.19/assert/assert.c:92:0
#8 0x00007f723c5eec32 (/lib/x86_64-linux-gnu/libc.so.6+0x2fc32)
#9 0x0000000002838fe2 llvm::Value::~Value()
(/usr/local/clang-trunk/bin/clang-3.9+0x2838fe2)
#10 0x0000000002727cae llvm::User::~User()
(/usr/local/clang-trunk/bin/clang-3.9+0x2727cae)
#11 0x00000000027b321a llvm::Instruction::~Instruction()
(/usr/local/clang-trunk/bin/clang-3.9+0x27b321a)
#12 0x00000000027b83f2 llvm::UnaryInstruction::~UnaryInstruction()
(/usr/local/clang-trunk/bin/clang-3.9+0x27b83f2)
#13 0x00000000027c3d06 llvm::CastInst::~CastInst()
(/usr/local/clang-trunk/bin/clang-3.9+0x27c3d06)
#14 0x00000000027caec6 llvm::ZExtInst::~ZExtInst()
(/usr/local/clang-trunk/bin/clang-3.9+0x27caec6)
#15 0x00000000027caef6 llvm::ZExtInst::~ZExtInst()
(/usr/local/clang-trunk/bin/clang-3.9+0x27caef6)
#16 0x00000000025e39d7
llvm::ilist_node_traits<llvm::Instruction>::deleteNode(llvm::Instruction*)
(/usr/local/clang-trunk/bin/clang-3.9+0x25e39d7)
#17 0x00000000025e3387 llvm::iplist<llvm::Instruction,
llvm::SymbolTableListTraits<llvm::Instruction>
>::erase(llvm::ilist_iterator<llvm::Instruction>)
(/usr/local/clang-trunk/bin/clang-3.9+0x25e3387)
#18 0x0000000002716bb3 llvm::iplist<llvm::Instruction,
llvm::SymbolTableListTraits<llvm::Instruction>
>::erase(llvm::ilist_iterator<llvm::Instruction>,
llvm::ilist_iterator<llvm::Instruction>)
(/usr/local/clang-trunk/bin/clang-3.9+0x2716bb3)
#19 0x000000000271660a llvm::iplist<llvm::Instruction,
llvm::SymbolTableListTraits<llvm::Instruction> >::clear()
(/usr/local/clang-trunk/bin/clang-3.9+0x271660a)
#20 0x0000000002714e01 llvm::BasicBlock::~BasicBlock()
(/usr/local/clang-trunk/bin/clang-3.9+0x2714e01)
#21 0x0000000002714e4c llvm::BasicBlock::~BasicBlock()
(/usr/local/clang-trunk/bin/clang-3.9+0x2714e4c)
#22 0x0000000002716d25
llvm::ilist_node_traits<llvm::BasicBlock>::deleteNode(llvm::BasicBlock*)
(/usr/local/clang-trunk/bin/clang-3.9+0x2716d25)
#23 0x000000000271680b llvm::iplist<llvm::BasicBlock,
llvm::SymbolTableListTraits<llvm::BasicBlock>
>::erase(llvm::ilist_iterator<llvm::BasicBlock>)
(/usr/local/clang-trunk/bin/clang-3.9+0x271680b)
#24 0x0000000002714f11 llvm::BasicBlock::eraseFromParent()
(/usr/local/clang-trunk/bin/clang-3.9+0x2714f11)
#25 0x0000000002afb153 (anonymous
namespace)::LoopDeletion::runOnLoop(llvm::Loop*, llvm::LPPassManager&)
(/usr/local/clang-trunk/bin/clang-3.9+0x2afb153)
#26 0x000000000382eed1 llvm::LPPassManager::runOnFunction(llvm::Function&)
(/usr/local/clang-trunk/bin/clang-3.9+0x382eed1)
#27 0x00000000027ebf58 llvm::FPPassManager::runOnFunction(llvm::Function&)
(/usr/local/clang-trunk/bin/clang-3.9+0x27ebf58)
#28 0x000000000380a819 (anonymous
namespace)::CGPassManager::RunPassOnSCC(llvm::Pass*, llvm::CallGraphSCC&,
llvm::CallGraph&, bool&, bool&)
(/usr/local/clang-trunk/bin/clang-3.9+0x380a819)
#29 0x000000000380b915 (anonymous
namespace)::CGPassManager::RunAllPassesOnSCC(llvm::CallGraphSCC&,
llvm::CallGraph&, bool&) (/usr/local/clang-trunk/bin/clang-3.9+0x380b915)
#30 0x000000000380bc38 (anonymous
namespace)::CGPassManager::runOnModule(llvm::Module&)
(/usr/local/clang-trunk/bin/clang-3.9+0x380bc38)
#31 0x00000000027ec486 (anonymous
namespace)::MPPassManager::runOnModule(llvm::Module&)
(/usr/local/clang-trunk/bin/clang-3.9+0x27ec486)
#32 0x00000000027ecbf0 llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/usr/local/clang-trunk/bin/clang-3.9+0x27ecbf0)
#33 0x00000000027ece31 llvm::legacy::PassManager::run(llvm::Module&)
(/usr/local/clang-trunk/bin/clang-3.9+0x27ece31)
#34 0x0000000002e89374 (anonymous
namespace)::EmitAssemblyHelper::EmitAssembly(clang::BackendAction,
llvm::raw_pwrite_stream*) (/usr/local/clang-trunk/bin/clang-3.9+0x2e89374)
#35 0x0000000002e894bb 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-3.9+0x2e894bb)
#36 0x00000000036bfe4f
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
(/usr/local/clang-trunk/bin/clang-3.9+0x36bfe4f)
#37 0x0000000003ef2148 clang::ParseAST(clang::Sema&, bool, bool)
(/usr/local/clang-trunk/bin/clang-3.9+0x3ef2148)
#38 0x000000000332976a clang::ASTFrontendAction::ExecuteAction()
(/usr/local/clang-trunk/bin/clang-3.9+0x332976a)
#39 0x00000000036c2cb8 clang::CodeGenAction::ExecuteAction()
(/usr/local/clang-trunk/bin/clang-3.9+0x36c2cb8)
#40 0x000000000332922f clang::FrontendAction::Execute()
(/usr/local/clang-trunk/bin/clang-3.9+0x332922f)
#41 0x00000000032e40f8
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/usr/local/clang-trunk/bin/clang-3.9+0x32e40f8)
#42 0x000000000341cca6
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/usr/local/clang-trunk/bin/clang-3.9+0x341cca6)
#43 0x000000000157e726 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/usr/local/clang-trunk/bin/clang-3.9+0x157e726)
#44 0x00000000015758c3 ExecuteCC1Tool(llvm::ArrayRef<char const*>,
llvm::StringRef) (/usr/local/clang-trunk/bin/clang-3.9+0x15758c3)
#45 0x0000000001576391 main (/usr/local/clang-trunk/bin/clang-3.9+0x1576391)
#46 0x00007f723c5e0ec5 __libc_start_main
/build/buildd/eglibc-2.19/csu/libc-start.c:321:0
#47 0x0000000001571cf9 _start (/usr/local/clang-trunk/bin/clang-3.9+0x1571cf9)
Stack dump:
0.    Program arguments: /usr/local/clang-trunk/bin/clang-3.9 -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
-coverage-file /data2/small.c -resource-dir
/usr/local/clang-trunk/bin/../lib/clang/3.9.0 -internal-isystem
/usr/local/include -internal-isystem
/usr/local/clang-trunk/bin/../lib/clang/3.9.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 144 -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'.
4.    Running pass 'Loop Pass Manager' on function '@fn2'
5.    Running pass 'Delete dead loops' on basic block '%cond.false.us'
clang-3.9: error: unable to execute command: Aborted (core dumped)
clang-3.9: error: clang frontend command failed due to signal (use -v to see
invocation)
clang version 3.9.0 (trunk 260022)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/tools/bin
clang-3.9: 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-3.9: note: diagnostic msg: 
********************

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

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


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


int a, b, c[6], d, e, f, g;
char h = 1;

char
fn1 (int p1, int p2)
{
  return p1 + p2;
}

void
fn2 ()
{
  char i;
  f = 0;
  for (; f < 1; f = h)
    {
      e = 0;
      for (; e < 6; e++)
    {
      if (h)
        break;
      c[e] = 5;
    }
      i = 0;
      for (; i < 8; i = fn1 (i, 7))
    {
      g = a ? a : g && h && d < i;
      if (b)
        break;
    }
    }
}

-- 
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/20160208/6b91648d/attachment.html>


More information about the llvm-bugs mailing list