[all-commits] [llvm/llvm-project] ff426a: [compiler-rt] Fix signed integer overflow in int_m...

Karl-Johan Karlsson via All-commits all-commits at lists.llvm.org
Fri Mar 24 03:11:24 PDT 2023

  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: ff426a6250e9fa3860c00ef7c5c7e53534a4dc67
  Author: Karl-Johan Karlsson <karl-johan.karlsson at ericsson.com>
  Date:   2023-03-24 (Fri, 24 Mar 2023)

  Changed paths:
    M compiler-rt/lib/builtins/int_mulo_impl.inc

  Log Message:
  [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

More information about the All-commits mailing list