[llvm] r358970 - Fix MSVC "32-bit shift implicitly converted to 64 bits" warning. NFCI.

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 23 04:16:16 PDT 2019


Author: rksimon
Date: Tue Apr 23 04:16:16 2019
New Revision: 358970

URL: http://llvm.org/viewvc/llvm-project?rev=358970&view=rev
Log:
Fix MSVC "32-bit shift implicitly converted to 64 bits" warning. NFCI.

Modified:
    llvm/trunk/lib/ExecutionEngine/JITLink/MachO_x86_64.cpp

Modified: llvm/trunk/lib/ExecutionEngine/JITLink/MachO_x86_64.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/ExecutionEngine/JITLink/MachO_x86_64.cpp?rev=358970&r1=358969&r2=358970&view=diff
==============================================================================
--- llvm/trunk/lib/ExecutionEngine/JITLink/MachO_x86_64.cpp (original)
+++ llvm/trunk/lib/ExecutionEngine/JITLink/MachO_x86_64.cpp Tue Apr 23 04:16:16 2019
@@ -235,7 +235,7 @@ private:
           AtomToFix = &*AtomToFixOrErr;
         }
 
-        if (FixupAddress + static_cast<JITTargetAddress>(1 << RI.r_length) >
+        if (FixupAddress + static_cast<JITTargetAddress>(1ULL << RI.r_length) >
             AtomToFix->getAddress() + AtomToFix->getContent().size())
           return make_error<JITLinkError>(
               "Relocation content extends past end of fixup atom");
@@ -299,7 +299,7 @@ private:
         case PCRel32Minus2Anon:
         case PCRel32Minus4Anon: {
           JITTargetAddress Delta =
-              static_cast<JITTargetAddress>(1 << (*Kind - PCRel32Minus1Anon));
+              static_cast<JITTargetAddress>(1ULL << (*Kind - PCRel32Minus1Anon));
           JITTargetAddress TargetAddress =
               FixupAddress + 4 + Delta + *(const ulittle32_t *)FixupContent;
           if (auto TargetAtomOrErr = G.findAtomByAddress(TargetAddress))




More information about the llvm-commits mailing list