[llvm-bugs] [Bug 43462] New: Null pointer dereference warning inside PrintActions1

via llvm-bugs llvm-bugs at lists.llvm.org
Thu Sep 26 06:19:08 PDT 2019


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

            Bug ID: 43462
           Summary: Null pointer dereference warning inside PrintActions1
           Product: clang
           Version: unspecified
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: Driver
          Assignee: unassignedclangbugs at nondot.org
          Reporter: llvm-dev at redking.me.uk
                CC: llvm-bugs at lists.llvm.org, neeilans at live.com,
                    richard-llvm at metafoo.co.uk

llvm-project\clang\lib\Driver\Driver.cpp

Clang static analyzer is warning that we might be dereferencing a null pointer
to 'const ToolChain *TC' inside PrintActions1:

https://llvm.org/reports/scan-build/report-Driver.cpp-operator()-13-1.html#EndPath

const ToolChain *TC;
....
if (TC)
  os << A->getOffloadingKindPrefix();
else
  os << "host";
os << " (";
os << TC->getTriple().normalize();


Code coverage indicates that the !TC path is never taken in testsuite, and a
quick inspection of doOnHostDependence and doOnEachDeviceDependence suggests we
shouldn't ever call it with TC == null, so maybe we should just assert that TC
is not null and remove the 'host' case?

http://lab.llvm.org:8080/coverage/coverage-reports/clang/coverage/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/tools/clang/lib/Driver/Driver.cpp.html

-- 
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/20190926/f56b6ac8/attachment-0001.html>


More information about the llvm-bugs mailing list