[llvm-bugs] [Bug 24602] New: Crash while running X86 DAG->DAG Instruction Selection

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Aug 27 12:16:19 PDT 2015


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

            Bug ID: 24602
           Summary: Crash while running X86 DAG->DAG Instruction Selection
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: Common Code Generator Code
          Assignee: unassignedbugs at nondot.org
          Reporter: rtrieu at google.com
                CC: llvm-bugs at lists.llvm.org
    Classification: Unclassified

crash.cc:
typedef int int32;
typedef long long int64;
typedef unsigned long long uint64;

const int64 BigNum = 10000000000LL;

void Set(int64 A1, int64 A2);

int32 SmallNum = 10;

void SetupInputScanner(int64 input) {
  int64 I1 = input - (2 * SmallNum * BigNum);
  int64 I2 = input - (BigNum);
  Set(I1, I2);
}

Command line:
clang -cc1 -emit-obj crash.cc -O2

Root cause:
At lib/CodeGen/SelectionDAG/SelectionDAG.cpp:3345, N2 is null in the dyn_cast.

3342:  SDValue SelectionDAG::getNode(unsigned Opcode, SDLoc DL, EVT VT, SDValue
N1,
3343:                                SDValue N2, const SDNodeFlags *Flags) {
3344:    ConstantSDNode *N1C = dyn_cast<ConstantSDNode>(N1);
3345:    ConstantSDNode *N2C = dyn_cast<ConstantSDNode>(N2);
3346:    switch (Opcode) {
3347:    default: break;

Stack dump:
0.    Program arguments: clang -cc1 -emit-obj crash.cc -O2 
1.    <eof> parser at end of file
2.    Code generation
3.    Running pass 'Function Pass Manager' on module 'crash.cc'.
4.    Running pass 'X86 DAG->DAG Instruction Selection' on function
'@_Z17SetupInputScannerx'

Trace:
clang: ../include/llvm/Support/Casting.h:81: static bool
llvm::isa_impl_cl<llvm::ConstantSDNode, llvm::SDNode *>::doit(const From *) [To
= llvm::ConstantSDNode, From = llvm::SDNode *]: Assertion `Val && "isa<> used
on a null pointer"' failed.
#8 0x7feea2d1fc32 (/lib/x86_64-linux-gnu/libc.so.6+0x2fc32)
#9 0xb65b5b llvm::isa_impl_cl<llvm::ConstantSDNode,
llvm::SDNode*>::doit(llvm::SDNode const*)
  ../include/llvm/Support/Casting.h:82:38
#10 0xb65b08 llvm::isa_impl_wrap<llvm::ConstantSDNode, llvm::SDNode*,
llvm::SDNode*>::doit(llvm::SDNode* const&)
  ../include/llvm/Support/Casting.h:122:5
#11 0xb65ae2 llvm::isa_impl_wrap<llvm::ConstantSDNode, llvm::SDValue const,
llvm::SDNode*>::doit(llvm::SDValue const&) 
  ../include/llvm/Support/Casting.h:112:5
#12 0xb65ab5 bool llvm::isa<llvm::ConstantSDNode, llvm::SDValue>(llvm::SDValue
const&) 
  ../include/llvm/Support/Casting.h:133:3
#13 0xbc2cc5 llvm::cast_retty<llvm::ConstantSDNode, llvm::SDValue>::ret_type
llvm::dyn_cast<llvm::ConstantSDNode, llvm::SDValue>(llvm::SDValue&)
  ../include/llvm/Support/Casting.h:292:10
#14 0x2ba9c29 llvm::SelectionDAG::getNode(unsigned int, llvm::SDLoc, llvm::EVT,
llvm::SDValue, llvm::SDValue, llvm::SDNodeFlags const*)
  ../lib/CodeGen/SelectionDAG/SelectionDAG.cpp:3345:19
#15 0x2aed1ec (anonymous namespace)::DAGCombiner::visitSHL(llvm::SDNode*)
  ../lib/CodeGen/SelectionDAG/DAGCombiner.cpp:4461:14
#16 0x2ad5f0e (anonymous namespace)::DAGCombiner::visit(llvm::SDNode*)
  ../lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1353:40
#17 0x2ad56cb (anonymous namespace)::DAGCombiner::combine(llvm::SDNode*)
  ../lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1421:16
#18 0x2ad4db7 (anonymous namespace)::DAGCombiner::Run(llvm::CombineLevel)
  ../lib/CodeGen/SelectionDAG/DAGCombiner.cpp:1274:18
#19 0x2ad4842 llvm::SelectionDAG::Combine(llvm::CombineLevel,
llvm::AliasAnalysis&, llvm::CodeGenOpt::Level)
  ../lib/CodeGen/SelectionDAG/DAGCombiner.cpp:14300:3
#20 0x2c4f072 llvm::SelectionDAGISel::CodeGenAndEmitDAG()
  ../lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:702:5
#21 0x2c4ed1f
llvm::SelectionDAGISel::SelectBasicBlock(llvm::ilist_iterator<llvm::Instruction
const>, llvm::ilist_iterator<llvm::Instruction const>, bool&)
  ../lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:627:1
#22 0x2c4eb7e llvm::SelectionDAGISel::SelectAllBasicBlocks(llvm::Function
const&)
  ../lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:1323:5
#23 0x2c4cdaf
llvm::SelectionDAGISel::runOnMachineFunction(llvm::MachineFunction&)
  ../lib/CodeGen/SelectionDAG/SelectionDAGISel.cpp:471:33
#24 0x151d82b (anonymous
namespace)::X86DAGToDAGISel::runOnMachineFunction(llvm::MachineFunction&)
  ../lib/Target/X86/X86ISelDAGToDAG.cpp:173:7
#25 0x1a077be llvm::MachineFunctionPass::runOnFunction(llvm::Function&)
  ../lib/CodeGen/MachineFunctionPass.cpp:40:3
#26 0x1e5853f llvm::FPPassManager::runOnFunction(llvm::Function&)
  ../lib/IR/LegacyPassManager.cpp:1524:23
#27 0x1e58855 llvm::FPPassManager::runOnModule(llvm::Module&)
  ../lib/IR/LegacyPassManager.cpp:1545:16
#28 0x1e58efc (anonymous namespace)::MPPassManager::runOnModule(llvm::Module&)
  ../lib/IR/LegacyPassManager.cpp:1601:23
#29 0x1e58af1 llvm::legacy::PassManagerImpl::run(llvm::Module&)
  ../lib/IR/LegacyPassManager.cpp:1704:16
#30 0x1e593a1 llvm::legacy::PassManager::run(llvm::Module&)
  ../lib/IR/LegacyPassManager.cpp:1735:3
#31 0x246091c (anonymous
namespace)::EmitAssemblyHelper::EmitAssembly(clang::BackendAction,
llvm::raw_pwrite_stream*)
  ../tools/clang/lib/CodeGen/BackendUtil.cpp:648:5
#32 0x24601c2 clang::EmitBackendOutput(clang::DiagnosticsEngine&,
clang::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions
const&, llvm::StringRef, llvm::Module*, clang::BackendAction,
llvm::raw_pwrite_stream*)
  ../tools/clang/lib/CodeGen/BackendUtil.cpp:660:3
#33 0x2d35edc clang::BackendConsumer::HandleTranslationUnit(clang::ASTContext&)
  ../tools/clang/lib/CodeGen/CodeGenAction.cpp:183:7
#34 0x3750820 clang::ParseAST(clang::Sema&, bool, bool)
  ../tools/clang/lib/Parse/ParseAST.cpp:168:3
#35 0x2911760 clang::ASTFrontendAction::ExecuteAction()
  ../tools/clang/lib/Frontend/FrontendAction.cpp:540:1
#36 0x2d34d2e clang::CodeGenAction::ExecuteAction()
../tools/clang/lib/CodeGen/CodeGenAction.cpp:785:1
#37 0x2911240 clang::FrontendAction::Execute()
../tools/clang/lib/Frontend/FrontendAction.cpp:443:7
#38 0x28c9487 clang::CompilerInstance::ExecuteAction(clang::FrontendAction&)
  ../tools/clang/lib/Frontend/CompilerInstance.cpp:831:7
#39 0x2a35934 clang::ExecuteCompilerInvocation(clang::CompilerInstance*)
  ../tools/clang/lib/FrontendTool/ExecuteCompilerInvocation.cpp:222:8
#40 0xabf708 cc1_main(llvm::ArrayRef<char const*>, char const*, void*)
  ../tools/clang/tools/driver/cc1_main.cpp:116:11
#41 0xab4753 ExecuteCC1Tool(llvm::ArrayRef<char const*>, llvm::StringRef)
  ../tools/clang/tools/driver/driver.cpp:380:5

-- 
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/20150827/ee3f77b1/attachment.html>


More information about the llvm-bugs mailing list