From 1e74ecab174d4e4d5b7c2403b00778f3baa2262e Mon Sep 17 00:00:00 2001 From: James Henderson Date: Tue, 30 Oct 2018 10:55:14 +0000 Subject: [PATCH] [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 llvm-svn: 345579 --- lld/ELF/Arch/PPC64.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lld/ELF/Arch/PPC64.cpp b/lld/ELF/Arch/PPC64.cpp index 3c511e14d50e7..a12d714dc4c99 100644 --- a/lld/ELF/Arch/PPC64.cpp +++ b/lld/ELF/Arch/PPC64.cpp @@ -849,7 +849,8 @@ bool PPC64::adjustPrologueForCrossSplitStack(uint8_t *Loc, uint8_t *End, 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::min() + Config->SplitStackAdjustSize) { error(getErrorLocation(Loc) + "split-stack prologue adjustment overflows"); return false; }