Skip to content
Commit 854686f0 authored by Karl-Johan Karlsson's avatar Karl-Johan Karlsson
Browse files

[compiler-rt] Fix signed shift overflows in absvdi2.c, absvsi2.c, negvdi2.c and negvsi2.c

When compiling compiler-rt with -fsanitize=undefined and running testcases you
end up with the following warnings:

UBSan: absvdi2.c:21:23: left shift of 1 by 63 places cannot be represented in type 'di_int' (aka 'long long')
UBSan: absvsi2.c:21:23: left shift of 1 by 31 places cannot be represented in type 'si_int' (aka 'long')
UBSan: negvdi2.c:20:32: left shift of 1 by 63 places cannot be represented in type 'di_int' (aka 'long long')
UBSan: negvsi2.c:20:32: left shift of 1 by 31 places cannot be represented in type 'si_int' (aka 'long')

This can be avoided by doing the shift in a matching unsigned variant of the
type.

This was found in an out of tree target.

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D146932
parent fb77ca05
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment