summaryrefslogtreecommitdiffstats
path: root/clang/lib/Sema/SemaChecking.cpp
diff options
context:
space:
mode:
authorRichard Trieu <rtrieu@google.com>2012-11-15 03:43:50 +0000
committerRichard Trieu <rtrieu@google.com>2012-11-15 03:43:50 +0000
commit03c3a2f5bbf91157862a08c5a30fe9fb8e20465a (patch)
tree91270a1a0cab5887cb24735aa364a2cd0ce23f91 /clang/lib/Sema/SemaChecking.cpp
parent0f9f019ff8fc6dcc7ae13328c60cc4164ae13782 (diff)
downloadbcm5719-llvm-03c3a2f5bbf91157862a08c5a30fe9fb8e20465a.tar.gz
bcm5719-llvm-03c3a2f5bbf91157862a08c5a30fe9fb8e20465a.zip
Fix an off-by-one error by switching < to <= in -Wtautological-constant-out-of-range-compare and added test case.
llvm-svn: 168023
Diffstat (limited to 'clang/lib/Sema/SemaChecking.cpp')
-rw-r--r--clang/lib/Sema/SemaChecking.cpp2
1 files changed, 1 insertions, 1 deletions
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp
index 7fd28b61913..05fa2a06637 100644
--- a/clang/lib/Sema/SemaChecking.cpp
+++ b/clang/lib/Sema/SemaChecking.cpp
@@ -4385,7 +4385,7 @@ static void DiagnoseOutOfRangeComparison(Sema &S, BinaryOperator *E,
// Check to see if the constant is equivalent to a negative value
// cast to CommonT.
if (S.Context.getIntWidth(ConstantT) == S.Context.getIntWidth(CommonT) &&
- Value.isNegative() && Value.getMinSignedBits() < OtherWidth)
+ Value.isNegative() && Value.getMinSignedBits() <= OtherWidth)
return;
// The constant value rests between values that OtherT can represent after
// conversion. Relational comparison still works, but equality
OpenPOWER on IntegriCloud