[LLVMbugs] [Bug 19941] New: LICM.cpp:882: possible use of NULL pointer

bugzilla-daemon at llvm.org bugzilla-daemon at llvm.org
Wed Jun 4 03:53:35 PDT 2014


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

            Bug ID: 19941
           Summary: LICM.cpp:882: possible use of NULL pointer
           Product: new-bugs
           Version: trunk
          Hardware: PC
                OS: Linux
            Status: NEW
          Severity: normal
          Priority: P
         Component: new bugs
          Assignee: unassignedbugs at nondot.org
          Reporter: dcb314 at hotmail.com
                CC: llvmbugs at cs.uiuc.edu
    Classification: Unclassified

Created attachment 12604
  --> http://llvm.org/bugs/attachment.cgi?id=12604&action=edit
C source code

I recently compiled the attached code with llvm
trunk dated 20140604 with compiler flag -O2 under valgrind
and it said

==8278== Invalid read of size 8
==8278==    at 0x2497E60: llvm::BasicBlock::getTerminator() (ilist.h:386)
==8278==    by 0x210F9CB: (anonymous
namespace)::LICM::PromoteAliasSet(llvm::Ali
asSet&, llvm::SmallVectorImpl<llvm::BasicBlock*>&,
llvm::SmallVectorImpl<llvm::I
nstruction*>&, llvm::PredIteratorCache&) (LICM.cpp:882)
==8278==    by 0x2111383: (anonymous namespace)::LICM::runOnLoop(llvm::Loop*,
ll
vm::LPPassManager&) (LICM.cpp:299)
==8278==    by 0x234FA32: llvm::LPPassManager::runOnFunction(llvm::Function&)
(L
oopPass.cpp:235)
==8278==    by 0x2560518: llvm::FPPassManager::runOnFunction(llvm::Function&)
(L
egacyPassManager.cpp:1545)
==8278==    by 0x22AA470: (anonymous
namespace)::CGPassManager::runOnModule(llvm
::Module&) (CallGraphSCCPass.cpp:151)
==8278==    by 0x2560DB7: llvm::legacy::PassManagerImpl::run(llvm::Module&)
(Leg
acyPassManager.cpp:1623)
==8278==    by 0x8AF30F: clang::EmitBackendOutput(clang::DiagnosticsEngine&,
cla
ng::CodeGenOptions const&, clang::TargetOptions const&, clang::LangOptions
const
&, llvm::StringRef, llvm::Module*, clang::BackendAction, llvm::raw_ostream*)
(Ba
ckendUtil.cpp:589)
==8278==    by 0x8A7B16:
clang::BackendConsumer::HandleTranslationUnit(clang::AS
TContext&) (CodeGenAction.cpp:176)
==8278==    by 0xA59FC4: clang::ParseAST(clang::Sema&, bool, bool)
(ParseAST.cpp
:154)
==8278==    by 0x8A7EBA: clang::CodeGenAction::ExecuteAction()
(CodeGenAction.cp
p:676)
==8278==    by 0x712385: clang::FrontendAction::Execute()
(FrontendAction.cpp:41
5)
==8278==  Address 0x40 is not stack'd, malloc'd or (recently) free'd

LICM.cpp:882 is

  LoadInst *PreheaderLoad =
    new LoadInst(SomePtr, SomePtr->getName()+".promoted",
                 Preheader->getTerminator());

so it looks to me like Preheader is NULL.

-- 
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/20140604/0fe180f0/attachment.html>


More information about the llvm-bugs mailing list