aaron.ballman added a comment.

In https://reviews.llvm.org/D44559#1040435, @craig.topper wrote:

> Fair point, what is the default signedness of char?


It's decided by target architecture. ARM and PPC often use unsigned, x86 often 
uses signed.

> 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;
>   }

Yeah, this does seem to be just warning about arithmetic involving promotions, 
which seems rather chatty but is aligned with MISRA rule 10.6.


Repository:
  rC Clang

https://reviews.llvm.org/D44559



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

Reply via email to