[llvm-bugs] [Bug 44471] New: [SelectionDAG] OptLevelChanger::SavedFastISel uninitialized variable warning

via llvm-bugs llvm-bugs at lists.llvm.org
Mon Jan 6 08:34:58 PST 2020


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

            Bug ID: 44471
           Summary: [SelectionDAG] OptLevelChanger::SavedFastISel
                    uninitialized variable warning
           Product: libraries
           Version: trunk
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Common Code Generator Code
          Assignee: unassignedbugs at nondot.org
          Reporter: llvm-dev at redking.me.uk
                CC: llvm-bugs at lists.llvm.org, llvm-dev at ndave.org,
                    paul_robinson at playstation.sony.com,
                    spatel+llvm at rotateright.com

https://llvm.org/reports/scan-build/report-SelectionDAGISel.cpp-~OptLevelChanger-9-1.html#EndPath

OptLevelChanger(SelectionDAGISel &ISel,
                CodeGenOpt::Level NewOptLevel) : IS(ISel) {
  SavedOptLevel = IS.OptLevel;
  if (NewOptLevel == SavedOptLevel)
    return;
  IS.OptLevel = NewOptLevel;
  IS.TM.setOptLevel(NewOptLevel);
  DEBUG(dbgs() << "\nChanging optimization level for Function "
        << IS.MF->getFunction()->getName() << "\n");
  DEBUG(dbgs() << "\tBefore: -O" << SavedOptLevel
        << " ; After: -O" << NewOptLevel << "\n");
  SavedFastISel = IS.TM.Options.EnableFastISel;
  if (NewOptLevel == CodeGenOpt::None) {
    IS.TM.setFastISel(IS.TM.getO0WantsFastISel());
    DEBUG(dbgs() << "\tFastISel is "
          << (IS.TM.Options.EnableFastISel ? "enabled" : "disabled")
          << "\n");
  }
}

Static analyzer has noticed that SavedFastISel is not initialized if the
"NewOptLevel == SavedOptLevel" warl out occurs.

-- 
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/20200106/77880eed/attachment-0001.html>


More information about the llvm-bugs mailing list