[llvm-bugs] [Bug 32480] New: llvm/lib/Target/Hexagon/HexagonEarlyIfConv.cpp: PVS-Studio: two similar code fragments

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Mar 30 23:39:38 PDT 2017


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

            Bug ID: 32480
           Summary: llvm/lib/Target/Hexagon/HexagonEarlyIfConv.cpp:
                    PVS-Studio: two similar code fragments
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P
         Component: Backend: Hexagon
          Assignee: unassignedbugs at nondot.org
          Reporter: razmyslov at viva64.com
                CC: llvm-bugs at lists.llvm.org

We have found a bug using PVS-Studio tool. PVS-Studio is a static code analyzer
for C, C++ and C#: https://www.viva64.com/en/pvs-studio/

Analyzer warning: V778 Two similar code fragments were found. Perhaps, this is
a typo and 'FS' variable should be used instead of 'TS'. hexagonearlyifconv.cpp
549

bool HexagonEarlyIfConversion::isProfitable(....) const
{
  ....
  unsigned TS = 0, FS = 0, Spare = 0;
  if (FP.TrueB) {
    TS = std::distance(FP.TrueB->begin(),
      FP.TrueB->getFirstTerminator());
    if (TS < HEXAGON_PACKET_SIZE)
      Spare += HEXAGON_PACKET_SIZE-TS;     // <=
  }
  if (FP.FalseB) {
    FS = std::distance(FP.FalseB->begin(),
      FP.FalseB->getFirstTerminator());
    if (FS < HEXAGON_PACKET_SIZE)
      Spare += HEXAGON_PACKET_SIZE-TS;     // <= FS ???
  }
  unsigned TotalIn = TS+FS;
  ....
}

-- 
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/20170331/76a43ab6/attachment-0001.html>


More information about the llvm-bugs mailing list