diff options
author | Anton Yartsev <anton.yartsev@gmail.com> | 2016-12-25 00:57:51 +0000 |
---|---|---|
committer | Anton Yartsev <anton.yartsev@gmail.com> | 2016-12-25 00:57:51 +0000 |
commit | 5ac3720620849a28e6d6eddd20e791650c53b12d (patch) | |
tree | 64e93ff0e59fa82124eb3a6712d2db3825f577eb /clang/test/Analysis/malloc.c | |
parent | a7b624ec6a1f8cdfdffcaff270e15a70989a3ace (diff) | |
download | bcm5719-llvm-5ac3720620849a28e6d6eddd20e791650c53b12d.tar.gz bcm5719-llvm-5ac3720620849a28e6d6eddd20e791650c53b12d.zip |
Fix for PR15623 (corrected r290413 reverted at 290415). The patch eliminates unwanted ProgramState checker data propagation from an operand of the logical operation to operation result.
The patch also simplifies an assume of a constraint of the form: "(exp comparison_op expr) != 0" to true into an assume of "exp comparison_op expr" to true. (And similarly, an assume of the form "(exp comparison_op expr) == 0" to true as an assume of exp comparison_op expr to false.) which improves precision overall.
https://reviews.llvm.org/D22862
llvm-svn: 290505
Diffstat (limited to 'clang/test/Analysis/malloc.c')
-rw-r--r-- | clang/test/Analysis/malloc.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/clang/test/Analysis/malloc.c b/clang/test/Analysis/malloc.c index 51e2cd60432..d5bc6571e42 100644 --- a/clang/test/Analysis/malloc.c +++ b/clang/test/Analysis/malloc.c @@ -1763,6 +1763,17 @@ void testConstEscapeThroughAnotherField() { constEscape(&(s.x)); // could free s->p! } // no-warning +// PR15623 +int testNoCheckerDataPropogationFromLogicalOpOperandToOpResult(void) { + char *param = malloc(10); + char *value = malloc(10); + int ok = (param && value); + free(param); + free(value); + // Previously we ended up with 'Use of memory after it is freed' on return. + return ok; // no warning +} + // ---------------------------------------------------------------------------- // False negatives. |