mirror of
https://github.com/RPCSX/llvm.git
synced 2024-12-14 07:31:47 +00:00
[SystemZ] Fix fallout from r288374
Avoid undefined behavior due to too-large shift count. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@288391 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
b76e6a781e
commit
a0c671e038
@ -101,7 +101,8 @@ void SystemZMCAsmBackend::applyFixup(const MCFixup &Fixup, char *Data,
|
||||
|
||||
// Big-endian insertion of Size bytes.
|
||||
Value = extractBitsForFixup(Kind, Value);
|
||||
Value &= ((uint64_t)1 << BitSize) - 1;
|
||||
if (BitSize < 64)
|
||||
Value &= ((uint64_t)1 << BitSize) - 1;
|
||||
unsigned ShiftValue = (Size * 8) - 8;
|
||||
for (unsigned I = 0; I != Size; ++I) {
|
||||
Data[Offset + I] |= uint8_t(Value >> ShiftValue);
|
||||
|
Loading…
Reference in New Issue
Block a user