<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - LICM.cpp:882: possible use of NULL pointer"
   href="http://llvm.org/bugs/show_bug.cgi?id=19941">19941</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>LICM.cpp:882: possible use of NULL pointer
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>new-bugs
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>new bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>dcb314@hotmail.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvmbugs@cs.uiuc.edu
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=12604" name="attach_12604" title="C source code">attachment 12604</a> <a href="attachment.cgi?id=12604&action=edit" title="C source code">[details]</a></span>
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.</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>