[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
Loading
Please sign in to comment