[builtins] Fix signed integer overflows in fp_fixint_impl.inc
When compiling the builtins with the undefined behavior sanitizer and running testcases you end up with the following warning: UBSan: fp_fixint_impl.inc:39:42: left shift of 8388608 by 40 places cannot be represented in type 'fixint_t' (aka 'long long') UBSan: fp_fixint_impl.inc:39:17: signed integer overflow: -1 * -9223372036854775808 cannot be represented in type 'fixint_t' (aka 'long long') This can be avoided by doing the shift and the multiplication in a matching unsigned variant of the type. The added test only trigger the intended signed overflow case when the builtins are built with -D__SOFTFP__. This was found in an out of tree target. Reviewed By: MaskRay Differential Revision: https://reviews.llvm.org/D159069
parent
d7746220
Please register or sign in to comment