summaryrefslogtreecommitdiffstats
path: root/clang/test/Sema/compare.c
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2011-07-13 06:35:24 +0000
committerJohn McCall <rjmccall@apple.com>2011-07-13 06:35:24 +0000
commitc368838b20d84137f7e42ba02b00d3113fed7a57 (patch)
treeb08e4472e6897e0000a16e68855b88c8b6074db5 /clang/test/Sema/compare.c
parentf677a8e99eb93f078bfafe0792f5ae3e98885d8d (diff)
downloadbcm5719-llvm-c368838b20d84137f7e42ba02b00d3113fed7a57.tar.gz
bcm5719-llvm-c368838b20d84137f7e42ba02b00d3113fed7a57.zip
Make the integer-range analysis recognize ^= correctly,
and (while I'm at it) teach it to grok the results of simple assignments. The first is PR10336. llvm-svn: 135034
Diffstat (limited to 'clang/test/Sema/compare.c')
-rw-r--r--clang/test/Sema/compare.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/clang/test/Sema/compare.c b/clang/test/Sema/compare.c
index 5221b172a60..cd973d4885c 100644
--- a/clang/test/Sema/compare.c
+++ b/clang/test/Sema/compare.c
@@ -312,3 +312,18 @@ int rdar8511238() {
return 0;
return 20;
}
+
+// PR10336
+int test9(int sv, unsigned uv, long slv) {
+ return sv == (uv ^= slv); // expected-warning {{comparison of integers of different signs: 'int' and 'unsigned int'}}
+}
+
+void test10(void) {
+ int si;
+ unsigned int ui;
+ long sl;
+
+ _Bool b;
+ b = (si == (ui = sl)); // expected-warning {{comparison of integers of different signs: 'int' and 'unsigned int'}}
+ b = (si == (ui = sl&15));
+}
OpenPOWER on IntegriCloud