Skip to content
Commit 5ae3211b authored by Karl-Johan Karlsson's avatar Karl-Johan Karlsson
Browse files

[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
parent fb463778
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment