This is an archive of the discontinued LLVM Phabricator instance.

[analyzer] Delete alpha.deadcode.UnreachableCode checker
Needs ReviewPublic

Authored by martong on May 18 2022, 3:51 AM.

Details

Summary

This checker is fundamentally flawed, because this problem requires
all-path data-flow analysis.
This checker relies on the paths that have been visited during the
exploration of the exploded graph. There are no guarantees that the
symbolic execution will explore all paths. What's more, in practice,
most of the time it does not. Thus, we see way too many annoying false
positives.

Diff Detail

Event Timeline

martong created this revision.May 18 2022, 3:51 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 18 2022, 3:51 AM
martong requested review of this revision.May 18 2022, 3:51 AM
Herald added a project: Restricted Project. · View Herald TranscriptMay 18 2022, 3:51 AM
Herald added a subscriber: cfe-commits. · View Herald Transcript
martong added inline comments.May 18 2022, 3:52 AM
clang/include/clang/StaticAnalyzer/Checkers/Checkers.td
847

TODO, update the ReleseNotes.

steakhal added inline comments.May 18 2022, 4:58 AM
clang/lib/StaticAnalyzer/Checkers/UnreachableCodeChecker.cpp
53–54

I thought this check guards this checker to be meaningful. @martong

Could you please give a few examples of these FPs for the record?

martong marked an inline comment as done.May 18 2022, 8:25 AM

Could you please give a few examples of these FPs for the record?

Out of thin air I could come up with the following one below. Seems like try is not handled, but it is not attached to the fact of being non full-path. Maybe I was in too much rush, perhaps we should leave this checker here.

Besides, there is an annoying true positive which should be suppressed IMHO.

clang/lib/StaticAnalyzer/Checkers/UnreachableCodeChecker.cpp
53–54

To be honest, I missed this. So, at least the checker does not report, when the budge is out, i.e. when we definitely know for sure that we could not explore the whole graph.

On the other hand, even if there is no work remaining for the engine, we still cannot be sure that all theoretical program paths have been covered can we?

clang/test/Analysis/malloc.cpp