False positive: impossible path
| Bugzilla Link | 13426 |
| Resolution | FIXED |
| Resolved on | Jun 15, 2020 08:40 |
| Version | 3.1 |
| OS | FreeBSD |
| Reporter | LLVM Bugzilla Contributor |
| CC | @ASDenysPetrov,@AnnaZaks |
Extended Description
When running the analyzer against OpenAFS git master, vlserver/vl_utils.c reports a false uninitialized argument as shown here: http://hergotha.csail.mit.edu/~analyzer/2012-07-20-1/report-8QtTSW.html#EndPath If nextblockindex == blockindex is false (#3), then clearly the loop must execute at least once (#4), causing prevblockindex to be initialized (line 929).
clang version 3.1 (branches/release_31) Target: amd64-portbld-freebsd8.3 Thread model: posix
mentioned in issue llvm/llvm-bugzilla-archive#27674
Fixed by https://reviews.llvm.org/D78933
Confirmed. Proposed a fix https://reviews.llvm.org/D78933
*** Bug llvm/llvm-bugzilla-archive#27674 has been marked as a duplicate of this bug. ***
Actually, this is already tracked by radar://7670487
This could be addressed with alpha-renaming. Opened radar://12447480 for internal tracking.
Here's a similar one with less/greater:
int *test(int x, int y)
{
int i;
if (x >= y) {
i = 0;
} else {
if (x < y) {
i = 1;
}
}
return i;
}
And with a while-loop instead:
int *test(int x, int y) { int i; if (x >= y) { i = 0; } while (x < y) { i = 1; break; } return i; }
Reproducible with:
int foo(int y, int z) { int x; if (y == z) { x = 0; } else { if (y != z) { x = 1; } } return x; }
Cloned to radar://11928676
assigned to @ASDenysPetrov