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

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to