diff options
author | Douglas Gregor <dgregor@apple.com> | 2010-02-18 00:56:01 +0000 |
---|---|---|
committer | Douglas Gregor <dgregor@apple.com> | 2010-02-18 00:56:01 +0000 |
commit | 2853eac24e2e70a74d7da817653b0528b976039f (patch) | |
tree | 61ae95787c91ce4430bc856fcc964aa43fe6250d /lib/Sema/SemaStmt.cpp | |
parent | 6041111f3749e76a1712ec58dd17449bd3177ddd (diff) |
Don't diagnose overflow in case statements when the conversion is a
signed<->unsigned conversion with the same bit width. Fixes
<rdar://problem/7658121>.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96545 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaStmt.cpp')
-rw-r--r-- | lib/Sema/SemaStmt.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/Sema/SemaStmt.cpp b/lib/Sema/SemaStmt.cpp index d9f5b38eb9..bdd0962a11 100644 --- a/lib/Sema/SemaStmt.cpp +++ b/lib/Sema/SemaStmt.cpp @@ -340,11 +340,11 @@ void Sema::ConvertIntegerToTypeWarnOnOverflow(llvm::APSInt &Val, } else if (NewSign != Val.isSigned()) { // Convert the sign to match the sign of the condition. This can cause // overflow as well: unsigned(INTMIN) + // We don't diagnose this overflow, because it is implementation-defined + // behavior. + // FIXME: Introduce a second, default-ignored warning for this case? llvm::APSInt OldVal(Val); Val.setIsSigned(NewSign); - - if (Val.isNegative()) // Sign bit changes meaning. - Diag(Loc, DiagID) << OldVal.toString(10) << Val.toString(10); } } |