[PATCH] D86414: [compiler-rt][builtins] Fix some other cases of UB
Anatoly Trosinenko via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sat Aug 22 23:51:18 PDT 2020
atrosinenko created this revision.
atrosinenko added reviewers: scanon, koviankevin, MaskRay, howard.hinnant.
Herald added subscribers: Sanitizers, dberris.
Herald added a project: Sanitizers.
atrosinenko requested review of this revision.
This patch eliminates some other UB in a slightly more tricky way than D86299: [compiler-rt][builtins] Factor out some common bit manipulations <https://reviews.llvm.org/D86299>.
- Introduce a `SIGN_OF(signed_int)` macro (not UB-related, just to give this trick a descriptive name)
- Make the "negate if sign is -1" trick operate on corresponding **unsigned** types. Not factoring it out due to the "interface" of that macro would probably be quite error-prone.
This patch is expected to be NFC except for eliminating some UB identified by unit tests.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D86414
Files:
compiler-rt/lib/builtins/absvdi2.c
compiler-rt/lib/builtins/absvsi2.c
compiler-rt/lib/builtins/absvti2.c
compiler-rt/lib/builtins/floattidf.c
compiler-rt/lib/builtins/floattixf.c
compiler-rt/lib/builtins/int_div_impl.inc
compiler-rt/lib/builtins/int_types.h
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D86414.287243.patch
Type: text/x-patch
Size: 5509 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20200823/c51d60a4/attachment-0001.bin>
More information about the cfe-commits
mailing list