[llvm-bugs] [Bug 41665] New: SimplifyLibCalls.cpp - optimizeDoubleFP - checking a pointer after dereferencing

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Apr 29 15:48:04 PDT 2019


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

            Bug ID: 41665
           Summary: SimplifyLibCalls.cpp - optimizeDoubleFP - checking a
                    pointer after dereferencing
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Scalar Optimizations
          Assignee: unassignedbugs at nondot.org
          Reporter: llvm-dev at redking.me.uk
                CC: e.menezes at samsung.com, llvm-bugs at lists.llvm.org
            Blocks: 41655

Reported in https://www.viva64.com/en/b/0629/

static Value *optimizeDoubleFP(CallInst *CI, IRBuilder<> &B,
                               bool isBinary, bool isPrecise = false) {
  ....
  Function *CalleeFn = CI->getCalledFunction();
  StringRef CalleeNm = CalleeFn->getName();                 // <=
  AttributeList CalleeAt = CalleeFn->getAttributes();
  if (CalleeFn && !CalleeFn->isIntrinsic()) {               // <=
  ....
}

Theres a number of places later on as well that assume CalleeFn is not null.

Last touched by @evandro at rL338905

Do we actually need the if(CalleeFn) test - the previous version didn't check
at all.


Referenced Bugs:

https://bugs.llvm.org/show_bug.cgi?id=41655
[Bug 41655] Finding Bugs in LLVM 8 with PVS-Studio
-- 
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/20190429/613f0107/attachment.html>


More information about the llvm-bugs mailing list