[lld] r241530 - Fix undefined behaviour exposed by the new -Wshift-negative-value warning.
Davide Italiano
davide at freebsd.org
Mon Jul 6 17:02:59 PDT 2015
Author: davide
Date: Mon Jul 6 19:02:59 2015
New Revision: 241530
URL: http://llvm.org/viewvc/llvm-project?rev=241530&view=rev
Log:
Fix undefined behaviour exposed by the new -Wshift-negative-value warning.
Modified:
lld/trunk/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp
Modified: lld/trunk/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp?rev=241530&r1=241529&r2=241530&view=diff
==============================================================================
--- lld/trunk/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp (original)
+++ lld/trunk/lib/ReaderWriter/PECOFF/WriterPECOFF.cpp Mon Jul 6 19:02:59 2015
@@ -583,7 +583,7 @@ static void applyThumbBranchImmediate(ul
//
// I1 = ~(J1 ^ S), I2 = ~(J2 ^ S)
- assert((~abs(imm) & (-1 << 24)) && "bl/b.w out of range");
+ assert((~abs(imm) & (~0ULL << 24)) && "bl/b.w out of range");
uint32_t S = (imm < 0 ? 1 : 0);
uint32_t J1 = ((~imm & 0x00800000) >> 23) ^ S;
More information about the llvm-commits
mailing list