[PATCH] D44559: [Sema] Wrong width of result of mul operation

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 16 11:45:09 PDT 2018


craig.topper added a comment.

gcc also warns for this

short foo(char a) {

  return a * a;

}

Despite the fact that the char would be promoted to int, the upper bits are just sign bits and the multiply result still fits in a short.


Repository:
  rC Clang

https://reviews.llvm.org/D44559





More information about the llvm-commits mailing list