projects
/
oota-llvm.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
19eda53
)
MC: Avoid some UB caused by left shifting a negative value. NFC
author
Justin Bogner
<mail@justinbogner.com>
Thu, 14 May 2015 23:54:49 +0000
(23:54 +0000)
committer
Justin Bogner
<mail@justinbogner.com>
Thu, 14 May 2015 23:54:49 +0000
(23:54 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@237408
91177308
-0d34-0410-b5e6-
96231b3b80d8
lib/MC/MachObjectWriter.cpp
patch
|
blob
|
history
diff --git
a/lib/MC/MachObjectWriter.cpp
b/lib/MC/MachObjectWriter.cpp
index dc68a89e6ea9eca17e4b306c30842b527a5415b5..248775c625e423f99b0f6a83695c7165bcda5470 100644
(file)
--- a/
lib/MC/MachObjectWriter.cpp
+++ b/
lib/MC/MachObjectWriter.cpp
@@
-637,7
+637,7
@@
void MachObjectWriter::ComputeSymbolTable(
unsigned Index = Rel.Sym->getIndex();
assert(isInt<24>(Index));
if (IsLittleEndian)
- Rel.MRE.r_word1 = (Rel.MRE.r_word1 & (
-1
<< 24)) | Index | (1 << 27);
+ Rel.MRE.r_word1 = (Rel.MRE.r_word1 & (
~0U
<< 24)) | Index | (1 << 27);
else
Rel.MRE.r_word1 = (Rel.MRE.r_word1 & 0xff) | Index << 8 | (1 << 4);
}