summaryrefslogtreecommitdiffstats
path: root/test/Sema/compare.c
diff options
context:
space:
mode:
Diffstat (limited to 'test/Sema/compare.c')
-rw-r--r--test/Sema/compare.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/test/Sema/compare.c b/test/Sema/compare.c
index 2821a93..7c8c36f 100644
--- a/test/Sema/compare.c
+++ b/test/Sema/compare.c
@@ -274,3 +274,11 @@ void test4() {
if (value < (unsigned long) &ptr4) // expected-warning {{comparison of integers of different signs}}
return;
}
+
+// PR4807
+int test5(unsigned int x) {
+ return (x < 0) // expected-warning {{comparison of unsigned expression < 0 is always false}}
+ && (0 > x) // expected-warning {{comparison of 0 > unsigned expression is always false}}
+ && (x >= 0) // expected-warning {{comparison of unsigned expression >= 0 is always true}}
+ && (0 <= x); // expected-warning {{comparison of 0 <= unsigned expression is always true}}
+}
OpenPOWER on IntegriCloud