[lld] r345579 - [ELF][PPC64]Workaround bogus Visual Studio build warning

James Henderson via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 30 03:55:14 PDT 2018


Author: jhenderson
Date: Tue Oct 30 03:55:14 2018
New Revision: 345579

URL: http://llvm.org/viewvc/llvm-project?rev=345579&view=rev
Log:
[ELF][PPC64]Workaround bogus Visual Studio build warning

Visual Studio has a bug where it converts the integer literal 2147483648
into an unsigned int instead of a long long (i.e. it follows C89 rules).
The bug has been reported as:
https://developercommunity.visualstudio.com/content/problem/141813/-2147483648-c4146-error.html.

Because of this bug, we were getting a signed/unsigned comparison
warning in VS2015 from the old code (the subsequent unary negation had
no effect on the type).

Reviewed by: sfertile

Differential Revision: https://reviews.llvm.org/D53821

Modified:
    lld/trunk/ELF/Arch/PPC64.cpp

Modified: lld/trunk/ELF/Arch/PPC64.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Arch/PPC64.cpp?rev=345579&r1=345578&r2=345579&view=diff
==============================================================================
--- lld/trunk/ELF/Arch/PPC64.cpp (original)
+++ lld/trunk/ELF/Arch/PPC64.cpp Tue Oct 30 03:55:14 2018
@@ -849,7 +849,8 @@ bool PPC64::adjustPrologueForCrossSplitS
   int32_t StackFrameSize = (HiImm * 65536) + LoImm;
   // Check that the adjusted size doesn't overflow what we can represent with 2
   // instructions.
-  if (StackFrameSize < -2147483648 + Config->SplitStackAdjustSize) {
+  if (StackFrameSize <
+      std::numeric_limits<int32_t>::min() + Config->SplitStackAdjustSize) {
     error(getErrorLocation(Loc) + "split-stack prologue adjustment overflows");
     return false;
   }




More information about the llvm-commits mailing list