[compiler-rt] Fix signed integer overflow in int_mulo_impl.inc
authorKarl-Johan Karlsson <karl-johan.karlsson@ericsson.com>
Fri, 24 Mar 2023 09:33:46 +0000 (10:33 +0100)
committerKarl-Johan Karlsson <karl-johan.karlsson@ericsson.com>
Fri, 24 Mar 2023 10:02:34 +0000 (11:02 +0100)
commitff426a6250e9fa3860c00ef7c5c7e53534a4dc67
tree63b8fc19f5656ebfc1a299f6e95950e7971c8ca3
parent2a6e39dbf84af4b3f8b31930fed786b3c56287f5
[compiler-rt] Fix signed integer overflow in int_mulo_impl.inc

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

UBSan:/repo/uabkaka/llvm-project/compiler-rt/lib/builtins/int_mulo_impl.inc:24:23: signed integer overflow: -1 * -2147483648 cannot be represented in type 'si_int' (aka 'long')

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

This was found in an out of tree target.

Reviewed By: phosek

Differential Revision: https://reviews.llvm.org/D146623
compiler-rt/lib/builtins/int_mulo_impl.inc