[llvm-bugs] [Bug 32588] New: clang crashes on valid code at -O1 and above on x86_64-linux-gnu running pass 'X86 DAG->DAG Instruction Selection': Assertion `(!Node || !ResNo || ResNo < Node->getNumValues()) && "Invalid result number for the given node!"' failed

via llvm-bugs llvm-bugs at lists.llvm.org
Sun Apr 9 21:39:19 PDT 2017


http://bugs.llvm.org/show_bug.cgi?id=32588

            Bug ID: 32588
           Summary: clang crashes on valid code at -O1 and above on
                    x86_64-linux-gnu running pass 'X86 DAG->DAG
                    Instruction Selection': Assertion `(!Node || !ResNo ||
                    ResNo < Node->getNumValues()) && "Invalid result
                    number for the given node!"' failed
           Product: clang
           Version: trunk
          Hardware: PC
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: -New Bugs
          Assignee: unassignedclangbugs at nondot.org
          Reporter: su at cs.ucdavis.edu
                CC: llvm-bugs at lists.llvm.org

This appears to be a recent regression. 


$ clang -v
clang version 5.0.0 (trunk 299826)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/clang-trunk/bin
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/5
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/5.4.0
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/6
Found candidate GCC installation: /usr/lib/gcc/i686-linux-gnu/6.0.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.4
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
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.4.0
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6
Found candidate GCC installation: /usr/lib/gcc/x86_64-linux-gnu/6.0.0
Selected GCC installation: /usr/lib/gcc/x86_64-linux-gnu/5.4.0
Candidate multilib: .;@m64
Candidate multilib: 32;@m32
Candidate multilib: x32;@mx32
Selected multilib: .;@m64
$ 
$ clang-4.0.0 -c -w -O1 small.c
$ 
$ clang -c -w -O1 small.c
clang-5.0:
/tmp/llvm-builder/llvm-source-trunk/include/llvm/CodeGen/SelectionDAGNodes.h:952:
llvm::SDValue::SDValue(llvm::SDNode*, unsigned int): Assertion `(!Node ||
!ResNo || ResNo < Node->getNumValues()) && "Invalid result number for the given
node!"' failed.
#0 0x0000000001fa1a1a llvm::sys::PrintStackTrace(llvm::raw_ostream&)
(/usr/local/clang-trunk/bin/clang-5.0+0x1fa1a1a)
#1 0x0000000001f9f79e llvm::sys::RunSignalHandlers()
(/usr/local/clang-trunk/bin/clang-5.0+0x1f9f79e)
#2 0x0000000001f9f912 SignalHandler(int)
(/usr/local/clang-trunk/bin/clang-5.0+0x1f9f912)
#3 0x00007f84595a3390 __restore_rt
(/lib/x86_64-linux-gnu/libpthread.so.0+0x11390)
#4 0x00007f8458316428 gsignal
/build/glibc-9tT8Do/glibc-2.23/signal/../sysdeps/unix/sysv/linux/raise.c:54:0
#5 0x00007f845831802a abort /build/glibc-9tT8Do/glibc-2.23/stdlib/abort.c:91:0
#6 0x00007f845830ebd7 __assert_fail_base
/build/glibc-9tT8Do/glibc-2.23/assert/assert.c:92:0
#7 0x00007f845830ec82 (/lib/x86_64-linux-gnu/libc.so.6+0x2dc82)
#8 0x00000000013fa258 (/usr/local/clang-trunk/bin/clang-5.0+0x13fa258)
#9 0x00000000014aaf46 llvm::X86TargetLowering::PerformDAGCombine(llvm::SDNode*,
llvm::TargetLowering::DAGCombinerInfo&) const
(/usr/local/clang-trunk/bin/clang-5.0+0x14aaf46)
#10 0x0000000002693aeb (anonymous
namespace)::DAGCombiner::combine(llvm::SDNode*)
(/usr/local/clang-trunk/bin/clang-5.0+0x2693aeb)
#11 0x0000000002696c40 (anonymous
namespace)::DAGCombiner::Run(llvm::CombineLevel) [clone .constprop.642]
(/usr/local/clang-trunk/bin/clang-5.0+0x2696c40)
#12 0x0000000002698db0 llvm::SelectionDAG::Combine(llvm::CombineLevel,
llvm::AAResults&, llvm::CodeGenOpt::Level)
(/usr/local/clang-trunk/bin/clang-5.0+0x2698db0)
#13 0x000000000274f1d7 llvm::SelectionDAGISel::CodeGenAndEmitDAG()
(/usr/local/clang-trunk/bin/clang-5.0+0x274f1d7)
#14 0x0000000002759bb9
llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function const&)
(/usr/local/clang-trunk/bin/clang-5.0+0x2759bb9)
#15 0x000000000275b9d1
llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&) [clone
.part.735] [clone .constprop.758]
(/usr/local/clang-trunk/bin/clang-5.0+0x275b9d1)
#16 0x00000000013f6ee4 (anonymous
namespace)::X86DAGToDAGISel::runOnMachineFunction(llvm::MachineFunction&)
(/usr/local/clang-trunk/bin/clang-5.0+0x13f6ee4)
#17 0x00000000018092c5
llvm::MachineFunctionPass::runOnFunction(llvm::Function&)
(/usr/local/clang-trunk/bin/clang-5.0+0x18092c5)
#18 0x0000000001b0ba83 llvm::FPPassManager::runOnFunction(llvm::Function&)
(/usr/local/clang-trunk/bin/clang-5.0+0x1b0ba83)
#19 0x0000000001b0bb4c llvm::FPPassManager::runOnModule(llvm::Module&)
(/usr/local/clang-trunk/bin/clang-5.0+0x1b0bb4c)
#20 0x0000000001b0b5ed llvm::legacy::PassManagerImpl::run(llvm::Module&)
(/usr/local/clang-trunk/bin/clang-5.0+0x1b0b5ed)
#21 0x000000000215cc80 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+0x215cc80)
#22 0x000000000281ac49
clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
(/usr/local/clang-trunk/bin/clang-5.0+0x281ac49)
#23 0x0000000002bcc098 clang::ParseAST(clang::Sema&, bool, bool)
(/usr/local/clang-trunk/bin/clang-5.0+0x2bcc098)
#24 0x0000000002819f5a clang::CodeGenAction::ExecuteAction()
(/usr/local/clang-trunk/bin/clang-5.0+0x2819f5a)
#25 0x00000000024e68f6 clang::FrontendAction::Execute()
(/usr/local/clang-trunk/bin/clang-5.0+0x24e68f6)
#26 0x00000000024b88b6
clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
(/usr/local/clang-trunk/bin/clang-5.0+0x24b88b6)
#27 0x000000000256edfa
clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
(/usr/local/clang-trunk/bin/clang-5.0+0x256edfa)
#28 0x0000000000a894b8 cc1_main(llvm::ArrayRef<char const*>, char const*,
void*) (/usr/local/clang-trunk/bin/clang-5.0+0xa894b8)
#29 0x0000000000a1d6fc main (/usr/local/clang-trunk/bin/clang-5.0+0xa1d6fc)
#30 0x00007f8458301830 __libc_start_main
/build/glibc-9tT8Do/glibc-2.23/csu/../csu/libc-start.c:325:0
#31 0x0000000000a85b59 _start (/usr/local/clang-trunk/bin/clang-5.0+0xa85b59)
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
-coverage-notes-file /home/su/small.gcno -resource-dir
/usr/local/clang-trunk/lib/clang/5.0.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 -O1
-w -fdebug-compilation-dir /home/su -ferror-limit 19 -fmessage-length 160
-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-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 299826)
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /usr/local/clang-trunk/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-7ca796.c
clang-5.0: note: diagnostic msg: /tmp/small-7ca796.sh
clang-5.0: note: diagnostic msg: 

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


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


int a, b, c, d;

void fn1 ()
{
  int f = a, g = a = ~1;
  d = (-~0 ^ (g && c)) + -(b && f) / -a;
}

-- 
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/20170410/90c8c80a/attachment.html>


More information about the llvm-bugs mailing list