[all-commits] [llvm/llvm-project] bb0548: [compiler-rt] Avoid signed overflow in floatdidf.c...
Karl-Johan Karlsson via All-commits
all-commits at lists.llvm.org
Fri Mar 17 00:15:37 PDT 2023
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: bb0548a6edf0027eca8d92e021c45afd51b29c9e
https://github.com/llvm/llvm-project/commit/bb0548a6edf0027eca8d92e021c45afd51b29c9e
Author: Karl-Johan Karlsson <karl-johan.karlsson at ericsson.com>
Date: 2023-03-17 (Fri, 17 Mar 2023)
Changed paths:
M compiler-rt/lib/builtins/floatdidf.c
M compiler-rt/lib/builtins/floatdisf.c
Log Message:
-----------
[compiler-rt] Avoid signed overflow in floatdidf.c and floatdisf.c
When compiling compiler-rt with -fsanitize=undefined and running testcases you
end up with the following warning:
UBSan: floatdisf.c:27:15: signed integer overflow: 9223372036854775807 - -1 cannot be represented in type 'di_int' (aka 'long long')
This can be avoided by doing the subtraction in a matching unsigned variant of
the type, given that the overflow is the expected result of the subtraction.
The same kind of pattern exists in floatdidf.c
This was found in an out of tree target.
Reviewed By: phosek
Differential Revision: https://reviews.llvm.org/D146135
More information about the All-commits
mailing list