[llvm-bugs] [Bug 27747] New: clang crashes on valid code at -O1 and above on x86_64-linux-gnu: Assertion `N->getOpcode() != ISD::DELETED_NODE && "DELETED_NODE in CSEMap!"' failed

via llvm-bugs llvm-bugs at lists.llvm.org
Sat May 14 22:07:09 PDT 2016


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

            Bug ID: 27747
           Summary: clang crashes on valid code at -O1 and above on
                    x86_64-linux-gnu: Assertion `N->getOpcode() !=
                    ISD::DELETED_NODE && "DELETED_NODE in CSEMap!"' failed
           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 (as well as 3.6.x and later) crashes when compiling the
following test case on x86_64-linux-gnu at -O1 and above in both 32-bit and
64-bit modes.

This is a regression from 3.5.x. 


$ clang-trunk -v
clang version 3.9.0 (trunk 269554)
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.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.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 -O0 -c small.c
$ clang-3.5 -O1 -c small.c
$ 
$ clang-trunk -O1 -c small.c
clang-3.9:
/tmp/llvm-builder/llvm-source-trunk/lib/CodeGen/SelectionDAG/SelectionDAG.cpp:772:
bool llvm::SelectionDAG::RemoveNodeFromCSEMaps(llvm::SDNode*): Assertion
`N->getOpcode() != ISD::DELETED_NODE && "DELETED_NODE in CSEMap!"' failed.
#0 0x0000000001dd8595 llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/usr/local/clang-trunk/bin/clang-3.9+0x1dd8595)
#1 0x0000000001dd6526 llvm::sys::RunSignalHandlers()
(/usr/local/clang-trunk/bin/clang-3.9+0x1dd6526)
#2 0x0000000001dd6744 SignalHandler(int)
(/usr/local/clang-trunk/bin/clang-3.9+0x1dd6744)
#3 0x00007f8d6b6c9340 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x10340)
#4 0x00007f8d6a8e7cc9 gsignal
/build/eglibc-3GlaMS/eglibc-2.19/signal/../nptl/sysdeps/unix/sysv/linux/raise.c:56:0
#5 0x00007f8d6a8eb0d8 abort
/build/eglibc-3GlaMS/eglibc-2.19/stdlib/abort.c:91:0
#6 0x00007f8d6a8e0b86 __assert_fail_base
/build/eglibc-3GlaMS/eglibc-2.19/assert/assert.c:92:0
#7 0x00007f8d6a8e0c32 (/lib/x86_64-linux-gnu/libc.so.6+0x2fc32)
#8 0x000000000246b6cf llvm::SelectionDAG::RemoveNodeFromCSEMaps(llvm::SDNode*)
(/usr/local/clang-trunk/bin/clang-3.9+0x246b6cf)
#9 0x000000000246bc71 llvm::SelectionDAG::DeleteNode(llvm::SDNode*)
(/usr/local/clang-trunk/bin/clang-3.9+0x246bc71)
#10 0x00000000023e7dcc llvm::SelectionDAG::Legalize()
(/usr/local/clang-trunk/bin/clang-3.9+0x23e7dcc)
#11 0x000000000247c924 llvm::SelectionDAGISel::CodeGenAndEmitDAG()
(/usr/local/clang-trunk/bin/clang-3.9+0x247c924)
#12 0x000000000248561f
llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&)
(/usr/local/clang-trunk/bin/clang-3.9+0x248561f)
#13 0x0000000002487b00
llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&)
(/usr/local/clang-trunk/bin/clang-3.9+0x2487b00)
#14 0x00000000013e7cc4 (anonymous
namespace)::X86DAGToDAGISel::runOnMachineFunction(llvm::MachineFunction&)
(/usr/local/clang-trunk/bin/clang-3.9+0x13e7cc4)
#15 0x00000000017c61a5
llvm::MachineFunctionPass::runOnFunction(llvm::Function&)
(/usr/local/clang-trunk/bin/clang-3.9+0x17c61a5)
#16 0x0000000001a4b433 llvm::FPPassManager::runOnFunction(llvm::Function&)
(/usr/local/clang-trunk/bin/clang-3.9+0x1a4b433)
#17 0x0000000001a4ba7b llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/usr/local/clang-trunk/bin/clang-3.9+0x1a4ba7b)
#18 0x0000000001f24cea clang::EmitBackendOutput(clang::DiagnosticsEngine&,
clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions
const&, llvm::DataLayout const&, llvm::Module*, clang::BackendAction,
llvm::raw_pwrite_stream*) (/usr/local/clang-trunk/bin/clang-3.9+0x1f24cea)
#19 0x000000000255600d
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
(/usr/local/clang-trunk/bin/clang-3.9+0x255600d)
#20 0x00000000028a6c3d clang::ParseAST(clang::Sema&, bool, bool)
(/usr/local/clang-trunk/bin/clang-3.9+0x28a6c3d)
#21 0x000000000255636e clang::CodeGenAction::ExecuteAction()
(/usr/local/clang-trunk/bin/clang-3.9+0x255636e)
#22 0x0000000002239fae clang::FrontendAction::Execute()
(/usr/local/clang-trunk/bin/clang-3.9+0x2239fae)
#23 0x0000000002210cf6
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/usr/local/clang-trunk/bin/clang-3.9+0x2210cf6)
#24 0x00000000022c4c72
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/usr/local/clang-trunk/bin/clang-3.9+0x22c4c72)
#25 0x0000000000adc638 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/usr/local/clang-trunk/bin/clang-3.9+0xadc638)
#26 0x0000000000a9661e main (/usr/local/clang-trunk/bin/clang-3.9+0xa9661e)
#27 0x00007f8d6a8d2ec5 __libc_start_main
/build/eglibc-3GlaMS/eglibc-2.19/csu/libc-start.c:321:0
#28 0x0000000000ad86a4 _start (/usr/local/clang-trunk/bin/clang-3.9+0xad86a4)
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 -O1 -fdebug-compilation-dir /data2
-ferror-limit 19 -fmessage-length 156 -fobjc-runtime=gcc
-fdiagnostics-show-option -fcolor-diagnostics -o small.o -x c small.c 
1.    <eof> parser at end of file
2.    Code generation
3.    Running pass 'Function Pass Manager' on module 'small.c'.
4.    Running pass 'X86 DAG->DAG Instruction Selection' on function '@fn1'
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 269554)
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-f56eb4.c
clang-3.9: note: diagnostic msg: /tmp/small-f56eb4.sh
clang-3.9: note: diagnostic msg: 

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


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


struct S
{
  int f0:18;
};

int a;

void
fn1 ()
{
  struct S b; 
  b.f0 = a;
  int c = a && b.f0, d = -(1 && b.f0) - c;
  a = d && ~b.f0; 
}

-- 
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/20160515/76120e5b/attachment-0001.html>


More information about the llvm-bugs mailing list