[LLVMdev] [PATCH] fix "32-bit shift" warning in MSVC

Chris Lattner clattner at apple.com
Mon Aug 16 09:36:14 PDT 2010


The warning was not indicating a bug, but it's ok to fix it in any case, I applied a patch in r111148.  Thanks!

-Chris

On Aug 16, 2010, at 4:03 AM, nobled wrote:

> This should fix this warning from Visual Studio 2010:
> 33>..\..\..\llvm-2.8svn-build\lib\MC\MachObjectWriter.cpp(772):
> warning C4334: '<<' : result of 32-bit shift implicitly converted to
> 64 bits (was 64-bit shift intended?)
> 
> 
> Index: lib/MC/MachObjectWriter.cpp
> ===================================================================
> --- lib/MC/MachObjectWriter.cpp	(revision 111120)
> +++ lib/MC/MachObjectWriter.cpp	(working copy)
> @@ -769,7 +769,7 @@
>       IsPCRel = 1;
>       FixedValue = (FixupAddress - Layout.getSymbolAddress(SD_B) +
>                     Target.getConstant());
> -      FixedValue += 1 << Log2Size;
> +      FixedValue += static_cast<uint64_t>(1) << Log2Size;
>     } else {
>       FixedValue = 0;
>     }
> <fix-32bit-warning.patch>_______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev





More information about the llvm-dev mailing list