[PATCH] D113753: [Analyzer][Core] Better simplification in SimpleSValBuilder::evalBinOpNN
Bjorn Pettersson via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Nov 26 10:24:46 PST 2021
bjope added a comment.
This seem to cause some weird results.
Given this input:
bar(short k) {
k++;
for (short f = 0; f < k; f++)
;
(long)k << 16;
}
we get
> clang --analyze --target=x86_64 'bbi-63538.c'
bbi-63538.c:5:11: warning: The result of the left shift is undefined due to shifting '1' by '16', which is unrepresentable in the unsigned version of the return type 'long' [core.UndefinedBinaryOperatorResult]
(long)k << 16;
~~~~~~~ ^
bbi-63538.c:5:11: warning: The result of the left shift is undefined due to shifting '2' by '16', which is unrepresentable in the unsigned version of the return type 'long' [core.UndefinedBinaryOperatorResult]
(long)k << 16;
~~~~~~~ ^
bbi-63538.c:5:11: warning: The result of the left shift is undefined due to shifting '3' by '16', which is unrepresentable in the unsigned version of the return type 'long' [core.UndefinedBinaryOperatorResult]
(long)k << 16;
~~~~~~~ ^
3 warnings generated.
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