[builtins] Fix signed shift overflows in ashlti3.c, ashrti3.c, ashldi3.c and ashrdi3.c
When compiling the builtins with the undefined behavior sanitizer and running testcases you end up with the following warning: UBSan: ashlti3.c:33:35: left shift of 1 by 63 places cannot be represented in type 'di_int' (aka 'long long') UBSan: ashrti3.c:34:34: left shift of negative value -81985529216486891 This can be avoided by doing the shift in a matching unsigned variant of the type. The same kind of patterns are found in ashldi3.c and ashrdi3.c This was found in an out of tree target. Reviewed By: MaskRay Differential Revision: https://reviews.llvm.org/D158819
Loading
Please sign in to comment