-
Notifications
You must be signed in to change notification settings - Fork 15.2k
Closed
Labels
bugzillaIssues migrated from bugzillaIssues migrated from bugzillaclang:static analyzerduplicateResolved as duplicateResolved as duplicate
Description
| Bugzilla Link | 2306 |
| Resolution | DUPLICATE |
| Resolved on | Dec 23, 2018 05:51 |
| Version | unspecified |
| OS | Linux |
| Blocks | llvm/llvm-bugzilla-archive#4272 llvm/llvm-bugzilla-archive#5628 |
| Attachments | checker html report |
| CC | @tkremenek,@haoNoQ |
Extended Description
Using SVN r50942:
/home/edwin/llvm-svn/llvm/tools/clang/utils/ccc-analyzer -c path_sens.c
path_sens.c
ANALYZE: path_sens.c foo
path_sens.c:10:11: warning: [CHECKER] Dereference of null pointer.
return *bar;
^~~
1 diagnostic generated.
int foo(int left, int right)
{
int x=5;
int *bar = 0;
while(left<=right) {
left++;
bar = &x;
}
if(left<=right) {
return *bar;
}
return 0;
}
See the attached html report, it says that the while() condition is false, and then the if() condition is true.
That can't happen, after the while (left<=right) is always false, hence the if is never entered.
Metadata
Metadata
Assignees
Labels
bugzillaIssues migrated from bugzillaIssues migrated from bugzillaclang:static analyzerduplicateResolved as duplicateResolved as duplicate