Skip to content
Commit 510b6b79 authored by Karl-Johan Karlsson's avatar Karl-Johan Karlsson
Browse files

[builtins] Fix signed integer overflows in divmodsi4.c, divmoddi4.c and divmodti4.c

When compiling the builtins with the undefined behavior sanitizer and running testcases you end up with the following warning:

UBSan: divmodsi4.c:22:17: signed integer overflow: 2147483647 - -1 cannot be represented in type 'si_int' (aka 'long')

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

The same kind of pattern is found in divmoddi4.c and divmodti4.c

This was found in an out of tree target.

Reviewed By: MaskRay

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