steakhal added a comment. In D113753#3156270 <https://reviews.llvm.org/D113753#3156270>, @bjope wrote:
> 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. Good catch @bjope ! Here is an example without the loop: https://godbolt.org/z/z3rqMz4bs We'll have a closer look. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D113753/new/ https://reviews.llvm.org/D113753 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits