[PATCH] D44559: Wrong width of result of mul operation for x86
Roman Lebedev via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Mar 16 10:20:41 PDT 2018
lebedev.ri added a comment.
In https://reviews.llvm.org/D44559#1040319, @craig.topper wrote:
> Why should the behavior be X86 specific?
>
> There also seems to be something weirder going on with gcc. They also warn on these.
>
> void foo(char c) {
>
> c = c + c;
>
> }
>
> void bar(short c) {
>
> c = c + c;
>
> }
Just want to point the obvious, https://godbolt.org/g/1SQSda
So as per AST (and language rules), it's actually
char foo(char c) {
int d = (int)c + (int)c;
return (char)d;
}
https://reviews.llvm.org/D44559
More information about the llvm-commits
mailing list