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: unassignedclangb...@nondot.org
          Reporter: llvm-...@redking.me.uk
                CC: llvm-bugs@lists.llvm.org, neeil...@live.com,
                    richard-l...@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.
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to