This is an archive of the discontinued LLVM Phabricator instance.

[BOLT][NFC] Fix UB due to left shift of negative value
ClosedPublic

Authored by jobnoorman on Apr 13 2023, 5:21 AM.

Details

Summary

The following test fails when enabling UBSan due to a left shift of a
negative value:

runtime error: left shift of negative value -2

BOLT :: AArch64/ext-island-ref.s

This patch fixes this by using a multiplication instead of a shift.

Diff Detail

Event Timeline

jobnoorman created this revision.Apr 13 2023, 5:21 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 13 2023, 5:21 AM
jobnoorman requested review of this revision.Apr 13 2023, 5:21 AM
Herald added a project: Restricted Project. · View Herald TranscriptApr 13 2023, 5:21 AM
yota9 accepted this revision.Apr 13 2023, 5:24 AM

LGTM

This revision is now accepted and ready to land.Apr 13 2023, 5:24 AM
This revision was automatically updated to reflect the committed changes.