summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorUlrich Weigand <ulrich.weigand@de.ibm.com>2016-12-01 18:00:50 +0000
committerUlrich Weigand <ulrich.weigand@de.ibm.com>2016-12-01 18:00:50 +0000
commitd36b31d03f75a648a51026981dd2c36f60541c01 (patch)
tree07f3669652b5ed8e3ed69f9fb0c14e8fdd3f66dc /llvm/lib
parentcf26d563901ac705a9115d620a5dea4944f77977 (diff)
downloadbcm5719-llvm-d36b31d03f75a648a51026981dd2c36f60541c01.tar.gz
bcm5719-llvm-d36b31d03f75a648a51026981dd2c36f60541c01.zip
[SystemZ] Fix fallout from r288374
Avoid undefined behavior due to too-large shift count. llvm-svn: 288391
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Target/SystemZ/MCTargetDesc/SystemZMCAsmBackend.cpp3
1 files changed, 2 insertions, 1 deletions
diff --git a/llvm/lib/Target/SystemZ/MCTargetDesc/SystemZMCAsmBackend.cpp b/llvm/lib/Target/SystemZ/MCTargetDesc/SystemZMCAsmBackend.cpp
index 1f3cdde1d74..9192448afd0 100644
--- a/llvm/lib/Target/SystemZ/MCTargetDesc/SystemZMCAsmBackend.cpp
+++ b/llvm/lib/Target/SystemZ/MCTargetDesc/SystemZMCAsmBackend.cpp
@@ -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);
OpenPOWER on IntegriCloud