summaryrefslogtreecommitdiffstats
path: root/clang/lib
diff options
context:
space:
mode:
authorDouglas Gregor <dgregor@apple.com>2010-02-18 00:56:01 +0000
committerDouglas Gregor <dgregor@apple.com>2010-02-18 00:56:01 +0000
commite5ad57a3ed0dea8c59015216d28bf924f06ec387 (patch)
tree93744f26d35400b00f38328d05274429104936d5 /clang/lib
parent4956ea0a512ef981c6c96e2f7147865d75f6eee6 (diff)
downloadbcm5719-llvm-e5ad57a3ed0dea8c59015216d28bf924f06ec387.tar.gz
bcm5719-llvm-e5ad57a3ed0dea8c59015216d28bf924f06ec387.zip
Don't diagnose overflow in case statements when the conversion is a
signed<->unsigned conversion with the same bit width. Fixes <rdar://problem/7658121>. llvm-svn: 96545
Diffstat (limited to 'clang/lib')
-rw-r--r--clang/lib/Sema/SemaStmt.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/clang/lib/Sema/SemaStmt.cpp b/clang/lib/Sema/SemaStmt.cpp
index d9f5b38eb90..bdd0962a11b 100644
--- a/clang/lib/Sema/SemaStmt.cpp
+++ b/clang/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);
}
}
OpenPOWER on IntegriCloud