[PATCH] D113753: [Analyzer][Core] Better simplification in SimpleSValBuilder::evalBinOpNN
Gabor Marton via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Dec 2 08:42:32 PST 2021
martong added a comment.
Here is a smaller reproducer:
void bar(short k) {
++k; // k1 = k0 + 1
assert(k == 1); // k1 == 1 --> k0 == 0
(long)k << 16; // k0 + 1 << 16
}
And the explanation is the following. With this patch, when the analyzer evaluates the `(long)k << 16` expression then it can properly deduce the value of `k` being `1`. However, it was not possible in the baseline. Since we do not model neither promotion nor explicit casts we get the false positive report. This issue highlights the importance of the patch stack to implement the modeling of casts (starting with https://reviews.llvm.org/D99797).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D113753/new/
https://reviews.llvm.org/D113753
More information about the cfe-commits
mailing list