diff options
author | Richard Trieu <rtrieu@google.com> | 2012-11-15 03:43:50 +0000 |
---|---|---|
committer | Richard Trieu <rtrieu@google.com> | 2012-11-15 03:43:50 +0000 |
commit | 5d1cf4f292cb060b1973eb197607fc6d5716bd12 (patch) | |
tree | 84fb13c305e11c1bfaee592ba1bf2bbfa2ead6e0 /lib | |
parent | 278057fd9f44684af832695cb01676c02a257b14 (diff) |
Fix an off-by-one error by switching < to <= in -Wtautological-constant-out-of-range-compare and added test case.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@168023 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/Sema/SemaChecking.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/Sema/SemaChecking.cpp b/lib/Sema/SemaChecking.cpp index 7fd28b6191..05fa2a0663 100644 --- a/lib/Sema/SemaChecking.cpp +++ b/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 |