Skip to content

Commit

Permalink
[ELF][PPC64]Workaround bogus Visual Studio build warning
Browse files Browse the repository at this point in the history
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
  • Loading branch information
jh7370 committed Oct 30, 2018
1 parent 858303b commit 1e74eca
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion lld/ELF/Arch/PPC64.cpp
Expand Up @@ -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<int32_t>::min() + Config->SplitStackAdjustSize) {
error(getErrorLocation(Loc) + "split-stack prologue adjustment overflows");
return false;
}
Expand Down

0 comments on commit 1e74eca

Please sign in to comment.