[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 12:04:42 PDT 2018


craig.topper added a comment.

Fair point, what is the default signedness of char?

FWIW, all these  warn in gcc. So they seem to be just checking purely based on the int promotion without any concern for the original size?

  unsigned short foo(unsigned char a) {
    return a * a;
  }
  
  signed short bar(signed char a) {
    return a * a;
  }
  
  signed short foo(signed char a) {
    return a + a;
  }
  
  unsigned short foo(unsigned char a) {
    return a + a;
  }


Repository:
  rC Clang

https://reviews.llvm.org/D44559





More information about the llvm-commits mailing list