[PATCH] D143471: [X86][MC][NFC] Refine code in X86MCCodeEmitter.cpp about opcode prefix
Phoebe Wang via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 10 06:06:20 PST 2023
pengfei added a comment.
In D143471#4118036 <https://reviews.llvm.org/D143471#4118036>, @skan wrote:
> In D143471#4117637 <https://reviews.llvm.org/D143471#4117637>, @uabelho wrote:
>
>> Hi,
>>
>> I noticed that if I run lit tests with ubsan built binaries with this patch there are many many tests failing like
>>
>> ../lib/Target/X86/MCTargetDesc/X86MCCodeEmitter.cpp:222:19: runtime error: left shift of negative value -1
>
> I think it's false positive?
>
> ~R << 7
>
> `R` is an `unsigned`, so `~R` is `unsigned` too. Although the value of `~R` may be `0xffffffff`. But I remember the left shift operation on `unsigned` is always well defined as long as the shift not exceed the size of `unsigned`.
I remember the `<<` operator is defined to shift signed int in C language. There's no relationship with the type of shifted value.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D143471/new/
https://reviews.llvm.org/D143471
More information about the llvm-commits
mailing list