Page MenuHomePhabricator

[compiler-rt][builtins] Fix some other cases of UB
Needs ReviewPublic

Authored by atrosinenko on Aug 22 2020, 11:51 PM.



This patch eliminates some other UB in a slightly more tricky way than D86299: [compiler-rt][builtins] Factor out some common bit manipulations.

  • 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.

Diff Detail

Event Timeline

atrosinenko created this revision.Aug 22 2020, 11:51 PM
Herald added a project: Restricted Project. · View Herald TranscriptAug 22 2020, 11:51 PM
Herald added subscribers: Restricted Project, dberris. · View Herald Transcript
atrosinenko requested review of this revision.Aug 22 2020, 11:51 PM

Re-upload with properly set parent review.