summaryrefslogtreecommitdiff
path: root/test/Sema
diff options
context:
space:
mode:
authorRoman Lebedev <lebedev.ri@gmail.com>2017-10-12 20:16:51 +0000
committerRoman Lebedev <lebedev.ri@gmail.com>2017-10-12 20:16:51 +0000
commitb9f3533558ed08b1a86b0f743af72321986f49b1 (patch)
tree220eb779fdc8797fb897be215f053343d1c97b1f /test/Sema
parentc284921aae819808986d750dc2d3650f8fb0bf01 (diff)
downloadclang-b9f3533558ed08b1a86b0f743af72321986f49b1.tar.gz
[Sema] Diagnose tautological comparison with type's min/max values
Summary: Currently, clang only diagnoses completely out-of-range comparisons (e.g. `char` and constant `300`), and comparisons of unsigned and `0`. But gcc also does diagnose the comparisons with the `std::numeric_limits<>::max()` / `std::numeric_limits<>::min()` so to speak Finally Fixes https://bugs.llvm.org/show_bug.cgi?id=34147 Continuation of https://reviews.llvm.org/D37565 Reviewers: rjmccall, rsmith, aaron.ballman Reviewed By: rsmith Subscribers: rtrieu, jroelofs, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D38101 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@315614 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Sema')
-rw-r--r--test/Sema/outof-range-constant-compare.c159
-rw-r--r--test/Sema/tautological-constant-compare.c514
-rw-r--r--test/Sema/tautological-unsigned-zero-compare.c377
3 files changed, 864 insertions, 186 deletions
diff --git a/test/Sema/outof-range-constant-compare.c b/test/Sema/outof-range-constant-compare.c
index 36b6ff69ca..ccb55e4a16 100644
--- a/test/Sema/outof-range-constant-compare.c
+++ b/test/Sema/outof-range-constant-compare.c
@@ -7,58 +7,6 @@ int main()
{
int a = value();
- if (a == 0x0000000000000000L)
- return 0;
- if (a != 0x0000000000000000L)
- return 0;
- if (a < 0x0000000000000000L)
- return 0;
- if (a <= 0x0000000000000000L)
- return 0;
- if (a > 0x0000000000000000L)
- return 0;
- if (a >= 0x0000000000000000L)
- return 0;
-
- if (0x0000000000000000L == a)
- return 0;
- if (0x0000000000000000L != a)
- return 0;
- if (0x0000000000000000L < a)
- return 0;
- if (0x0000000000000000L <= a)
- return 0;
- if (0x0000000000000000L > a)
- return 0;
- if (0x0000000000000000L >= a)
- return 0;
-
- if (a == 0x0000000000000000UL)
- return 0;
- if (a != 0x0000000000000000UL)
- return 0;
- if (a < 0x0000000000000000UL) // expected-warning {{comparison of unsigned expression < 0 is always false}}
- return 0;
- if (a <= 0x0000000000000000UL)
- return 0;
- if (a > 0x0000000000000000UL)
- return 0;
- if (a >= 0x0000000000000000UL) // expected-warning {{comparison of unsigned expression >= 0 is always true}}
- return 0;
-
- if (0x0000000000000000UL == a)
- return 0;
- if (0x0000000000000000UL != a)
- return 0;
- if (0x0000000000000000UL < a)
- return 0;
- if (0x0000000000000000UL <= a) // expected-warning {{comparison of 0 <= unsigned expression is always true}}
- return 0;
- if (0x0000000000000000UL > a) // expected-warning {{comparison of 0 > unsigned expression is always false}}
- return 0;
- if (0x0000000000000000UL >= a)
- return 0;
-
if (a == 0x1234567812345678L) // expected-warning {{comparison of constant 1311768465173141112 with expression of type 'int' is always false}}
return 0;
if (a != 0x1234567812345678L) // expected-warning {{comparison of constant 1311768465173141112 with expression of type 'int' is always true}}
@@ -155,113 +103,6 @@ int main()
if (0x1234567812345678L >= l)
return 0;
- unsigned un = 0;
- if (un == 0x0000000000000000L)
- return 0;
- if (un != 0x0000000000000000L)
- return 0;
- if (un < 0x0000000000000000L) // expected-warning {{comparison of unsigned expression < 0 is always false}}
- return 0;
- if (un <= 0x0000000000000000L)
- return 0;
- if (un > 0x0000000000000000L)
- return 0;
- if (un >= 0x0000000000000000L) // expected-warning {{comparison of unsigned expression >= 0 is always true}}
- return 0;
-
- if (0x0000000000000000L == un)
- return 0;
- if (0x0000000000000000L != un)
- return 0;
- if (0x0000000000000000L < un)
- return 0;
- if (0x0000000000000000L <= un) // expected-warning {{comparison of 0 <= unsigned expression is always true}}
- return 0;
- if (0x0000000000000000L > un) // expected-warning {{comparison of 0 > unsigned expression is always false}}
- return 0;
- if (0x0000000000000000L >= un)
- return 0;
-
- if (un == 0x0000000000000000UL)
- return 0;
- if (un != 0x0000000000000000UL)
- return 0;
- if (un < 0x0000000000000000UL) // expected-warning {{comparison of unsigned expression < 0 is always false}}
- return 0;
- if (un <= 0x0000000000000000UL)
- return 0;
- if (un > 0x0000000000000000UL)
- return 0;
- if (un >= 0x0000000000000000UL) // expected-warning {{comparison of unsigned expression >= 0 is always true}}
- return 0;
-
- if (0x0000000000000000UL == un)
- return 0;
- if (0x0000000000000000UL != un)
- return 0;
- if (0x0000000000000000UL < un)
- return 0;
- if (0x0000000000000000UL <= un) // expected-warning {{comparison of 0 <= unsigned expression is always true}}
- return 0;
- if (0x0000000000000000UL > un) // expected-warning {{comparison of 0 > unsigned expression is always false}}
- return 0;
- if (0x0000000000000000UL >= un)
- return 0;
-
- float fl = 0;
- if (fl == 0x0000000000000000L)
- return 0;
- if (fl != 0x0000000000000000L)
- return 0;
- if (fl < 0x0000000000000000L)
- return 0;
- if (fl <= 0x0000000000000000L)
- return 0;
- if (fl > 0x0000000000000000L)
- return 0;
- if (fl >= 0x0000000000000000L)
- return 0;
-
- if (0x0000000000000000L == fl)
- return 0;
- if (0x0000000000000000L != fl)
- return 0;
- if (0x0000000000000000L < fl)
- return 0;
- if (0x0000000000000000L <= fl)
- return 0;
- if (0x0000000000000000L > fl)
- return 0;
- if (0x0000000000000000L >= fl)
- return 0;
-
- double dl = 0;
- if (dl == 0x0000000000000000L)
- return 0;
- if (dl != 0x0000000000000000L)
- return 0;
- if (dl < 0x0000000000000000L)
- return 0;
- if (dl <= 0x0000000000000000L)
- return 0;
- if (dl > 0x0000000000000000L)
- return 0;
- if (dl >= 0x0000000000000000L)
- return 0;
-
- if (0x0000000000000000L == dl)
- return 0;
- if (0x0000000000000000L != dl)
- return 0;
- if (0x0000000000000000L < dl)
- return 0;
- if (0x0000000000000000L <= dl)
- return 0;
- if (0x0000000000000000L > dl)
- return 0;
- if (0x0000000000000000L >= dl)
- return 0;
-
enum E {
yes,
no,
diff --git a/test/Sema/tautological-constant-compare.c b/test/Sema/tautological-constant-compare.c
new file mode 100644
index 0000000000..b9ade2a2db
--- /dev/null
+++ b/test/Sema/tautological-constant-compare.c
@@ -0,0 +1,514 @@
+// RUN: %clang_cc1 -triple x86_64-linux-gnu -fsyntax-only -DTEST -verify %s
+// RUN: %clang_cc1 -triple x86_64-linux-gnu -fsyntax-only -Wno-tautological-constant-compare -verify %s
+// RUN: %clang_cc1 -triple x86_64-linux-gnu -fsyntax-only -DTEST -verify -x c++ %s
+// RUN: %clang_cc1 -triple x86_64-linux-gnu -fsyntax-only -Wno-tautological-constant-compare -verify -x c++ %s
+
+int value(void);
+
+#define macro(val) val
+
+#ifdef __cplusplus
+template<typename T>
+void TFunc() {
+ // Make sure that we do warn for normal variables in template functions !
+ unsigned char c = value();
+#ifdef TEST
+ if (c > 255) // expected-warning {{comparison 'unsigned char' > 255 is always false}}
+ return;
+#else
+ if (c > 255)
+ return;
+#endif
+
+ if (c > macro(255))
+ return;
+
+ T v = value();
+ if (v > 255)
+ return;
+ if (v > 32767)
+ return;
+}
+#endif
+
+int main()
+{
+#ifdef __cplusplus
+ TFunc<unsigned char>();
+ TFunc<signed short>();
+#endif
+
+ short s = value();
+
+#ifdef TEST
+ if (s == 32767)
+ return 0;
+ if (s != 32767)
+ return 0;
+ if (s < 32767)
+ return 0;
+ if (s <= 32767) // expected-warning {{comparison 'short' <= 32767 is always true}}
+ return 0;
+ if (s > 32767) // expected-warning {{comparison 'short' > 32767 is always false}}
+ return 0;
+ if (s >= 32767)
+ return 0;
+
+ if (32767 == s)
+ return 0;
+ if (32767 != s)
+ return 0;
+ if (32767 < s) // expected-warning {{comparison 32767 < 'short' is always false}}
+ return 0;
+ if (32767 <= s)
+ return 0;
+ if (32767 > s)
+ return 0;
+ if (32767 >= s) // expected-warning {{comparison 32767 >= 'short' is always true}}
+ return 0;
+
+ // FIXME: assumes two's complement
+ if (s == -32768)
+ return 0;
+ if (s != -32768)
+ return 0;
+ if (s < -32768) // expected-warning {{comparison 'short' < -32768 is always false}}
+ return 0;
+ if (s <= -32768)
+ return 0;
+ if (s > -32768)
+ return 0;
+ if (s >= -32768) // expected-warning {{comparison 'short' >= -32768 is always true}}
+ return 0;
+
+ if (-32768 == s)
+ return 0;
+ if (-32768 != s)
+ return 0;
+ if (-32768 < s)
+ return 0;
+ if (-32768 <= s) // expected-warning {{comparison -32768 <= 'short' is always true}}
+ return 0;
+ if (-32768 > s) // expected-warning {{comparison -32768 > 'short' is always false}}
+ return 0;
+ if (-32768 >= s)
+ return 0;
+
+ if (s == 32767UL)
+ return 0;
+ if (s != 32767UL)
+ return 0;
+ if (s < 32767UL)
+ return 0;
+ if (s <= 32767UL) // expected-warning {{comparison 'short' <= 32767 is always true}}
+ return 0;
+ if (s > 32767UL) // expected-warning {{comparison 'short' > 32767 is always false}}
+ return 0;
+ if (s >= 32767UL)
+ return 0;
+
+ if (32767UL == s)
+ return 0;
+ if (32767UL != s)
+ return 0;
+ if (32767UL < s) // expected-warning {{comparison 32767 < 'short' is always false}}
+ return 0;
+ if (32767UL <= s)
+ return 0;
+ if (32767UL > s)
+ return 0;
+ if (32767UL >= s) // expected-warning {{comparison 32767 >= 'short' is always true}}
+ return 0;
+
+ // FIXME: assumes two's complement
+ if (s == -32768L)
+ return 0;
+ if (s != -32768L)
+ return 0;
+ if (s < -32768L) // expected-warning {{comparison 'short' < -32768 is always false}}
+ return 0;
+ if (s <= -32768L)
+ return 0;
+ if (s > -32768L)
+ return 0;
+ if (s >= -32768L) // expected-warning {{comparison 'short' >= -32768 is always true}}
+ return 0;
+
+ if (-32768L == s)
+ return 0;
+ if (-32768L != s)
+ return 0;
+ if (-32768L < s)
+ return 0;
+ if (-32768L <= s) // expected-warning {{comparison -32768 <= 'short' is always true}}
+ return 0;
+ if (-32768L > s) // expected-warning {{comparison -32768 > 'short' is always false}}
+ return 0;
+ if (-32768L >= s)
+ return 0;
+#else
+ // expected-no-diagnostics
+ if (s == 32767)
+ return 0;
+ if (s != 32767)
+ return 0;
+ if (s < 32767)
+ return 0;
+ if (s <= 32767)
+ return 0;
+ if (s > 32767)
+ return 0;
+ if (s >= 32767)
+ return 0;
+
+ if (32767 == s)
+ return 0;
+ if (32767 != s)
+ return 0;
+ if (32767 < s)
+ return 0;
+ if (32767 <= s)
+ return 0;
+ if (32767 > s)
+ return 0;
+ if (32767 >= s)
+ return 0;
+
+ // FIXME: assumes two's complement
+ if (s == -32768)
+ return 0;
+ if (s != -32768)
+ return 0;
+ if (s < -32768)
+ return 0;
+ if (s <= -32768)
+ return 0;
+ if (s > -32768)
+ return 0;
+ if (s >= -32768)
+ return 0;
+
+ if (-32768 == s)
+ return 0;
+ if (-32768 != s)
+ return 0;
+ if (-32768 < s)
+ return 0;
+ if (-32768 <= s)
+ return 0;
+ if (-32768 > s)
+ return 0;
+ if (-32768 >= s)
+ return 0;
+
+ if (s == 32767UL)
+ return 0;
+ if (s != 32767UL)
+ return 0;
+ if (s < 32767UL)
+ return 0;
+ if (s <= 32767UL)
+ return 0;
+ if (s > 32767UL)
+ return 0;
+ if (s >= 32767UL)
+ return 0;
+
+ if (32767UL == s)
+ return 0;
+ if (32767UL != s)
+ return 0;
+ if (32767UL < s)
+ return 0;
+ if (32767UL <= s)
+ return 0;
+ if (32767UL > s)
+ return 0;
+ if (32767UL >= s)
+ return 0;
+
+ // FIXME: assumes two's complement
+ if (s == -32768L)
+ return 0;
+ if (s != -32768L)
+ return 0;
+ if (s < -32768L)
+ return 0;
+ if (s <= -32768L)
+ return 0;
+ if (s > -32768L)
+ return 0;
+ if (s >= -32768L)
+ return 0;
+
+ if (-32768L == s)
+ return 0;
+ if (-32768L != s)
+ return 0;
+ if (-32768L < s)
+ return 0;
+ if (-32768L <= s)
+ return 0;
+ if (-32768L > s)
+ return 0;
+ if (-32768L >= s)
+ return 0;
+#endif
+
+ if (s == 0)
+ return 0;
+ if (s != 0)
+ return 0;
+ if (s < 0)
+ return 0;
+ if (s <= 0)
+ return 0;
+ if (s > 0)
+ return 0;
+ if (s >= 0)
+ return 0;
+
+ if (0 == s)
+ return 0;
+ if (0 != s)
+ return 0;
+ if (0 < s)
+ return 0;
+ if (0 <= s)
+ return 0;
+ if (0 > s)
+ return 0;
+ if (0 >= s)
+ return 0;
+
+ // However the comparison with 0U would warn
+
+ unsigned short us = value();
+
+#ifdef TEST
+ if (us == 65535)
+ return 0;
+ if (us != 65535)
+ return 0;
+ if (us < 65535)
+ return 0;
+ if (us <= 65535) // expected-warning {{comparison 'unsigned short' <= 65535 is always true}}
+ return 0;
+ if (us > 65535) // expected-warning {{comparison 'unsigned short' > 65535 is always false}}
+ return 0;
+ if (us >= 65535)
+ return 0;
+
+ if (65535 == us)
+ return 0;
+ if (65535 != us)
+ return 0;
+ if (65535 < us) // expected-warning {{comparison 65535 < 'unsigned short' is always false}}
+ return 0;
+ if (65535 <= us)
+ return 0;
+ if (65535 > us)
+ return 0;
+ if (65535 >= us) // expected-warning {{comparison 65535 >= 'unsigned short' is always true}}
+ return 0;
+
+ if (us == 65535UL)
+ return 0;
+ if (us != 65535UL)
+ return 0;
+ if (us < 65535UL)
+ return 0;
+ if (us <= 65535UL) // expected-warning {{comparison 'unsigned short' <= 65535 is always true}}
+ return 0;
+ if (us > 65535UL) // expected-warning {{comparison 'unsigned short' > 65535 is always false}}
+ return 0;
+ if (us >= 65535UL)
+ return 0;
+
+ if (65535UL == us)
+ return 0;
+ if (65535UL != us)
+ return 0;
+ if (65535UL < us) // expected-warning {{comparison 65535 < 'unsigned short' is always false}}
+ return 0;
+ if (65535UL <= us)
+ return 0;
+ if (65535UL > us)
+ return 0;
+ if (65535UL >= us) // expected-warning {{comparison 65535 >= 'unsigned short' is always true}}
+ return 0;
+#else
+ // expected-no-diagnostics
+ if (us == 65535)
+ return 0;
+ if (us != 65535)
+ return 0;
+ if (us < 65535)
+ return 0;
+ if (us <= 65535)
+ return 0;
+ if (us > 65535)
+ return 0;
+ if (us >= 65535)
+ return 0;
+
+ if (65535 == us)
+ return 0;
+ if (65535 != us)
+ return 0;
+ if (65535 < us)
+ return 0;
+ if (65535 <= us)
+ return 0;
+ if (65535 > us)
+ return 0;
+ if (65535 >= us)
+ return 0;
+
+ if (us == 65535UL)
+ return 0;
+ if (us != 65535UL)
+ return 0;
+ if (us < 65535UL)
+ return 0;
+ if (us <= 65535UL)
+ return 0;
+ if (us > 65535UL)
+ return 0;
+ if (us >= 65535UL)
+ return 0;
+
+ if (65535UL == us)
+ return 0;
+ if (65535UL != us)
+ return 0;
+ if (65535UL < us)
+ return 0;
+ if (65535UL <= us)
+ return 0;
+ if (65535UL > us)
+ return 0;
+ if (65535UL >= us)
+ return 0;
+#endif
+
+ if (us == 32767)
+ return 0;
+ if (us != 32767)
+ return 0;
+ if (us < 32767)
+ return 0;
+ if (us <= 32767)
+ return 0;
+ if (us > 32767)
+ return 0;
+ if (us >= 32767)
+ return 0;
+
+ if (32767 == us)
+ return 0;
+ if (32767 != us)
+ return 0;
+ if (32767 < us)
+ return 0;
+ if (32767 <= us)
+ return 0;
+ if (32767 > us)
+ return 0;
+ if (32767 >= us)
+ return 0;
+
+ if (us == 32767UL)
+ return 0;
+ if (us != 32767UL)
+ return 0;
+ if (us < 32767UL)
+ return 0;
+ if (us <= 32767UL)
+ return 0;
+ if (us > 32767UL)
+ return 0;
+ if (us >= 32767UL)
+ return 0;
+
+ if (32767UL == us)
+ return 0;
+ if (32767UL != us)
+ return 0;
+ if (32767UL < us)
+ return 0;
+ if (32767UL <= us)
+ return 0;
+ if (32767UL > us)
+ return 0;
+ if (32767UL >= us)
+ return 0;
+
+#if __SIZEOF_INT128__
+ __int128 i128;
+ if (i128 == -1) // used to crash
+ return 0;
+#endif
+
+
+ enum E {
+ yes,
+ no,
+ maybe
+ };
+ enum E e;
+
+ if (e == yes)
+ return 0;
+ if (e != yes)
+ return 0;
+ if (e < yes)
+ return 0;
+ if (e <= yes)
+ return 0;
+ if (e > yes)
+ return 0;
+ if (e >= yes)
+ return 0;
+
+ if (yes == e)
+ return 0;
+ if (yes != e)
+ return 0;
+ if (yes < e)
+ return 0;
+ if (yes <= e)
+ return 0;
+ if (yes > e)
+ return 0;
+ if (yes >= e)
+ return 0;
+
+ if (e == maybe)
+ return 0;
+ if (e != maybe)
+ return 0;
+ if (e < maybe)
+ return 0;
+ if (e <= maybe)
+ return 0;
+ if (e > maybe)
+ return 0;
+ if (e >= maybe)
+ return 0;
+
+ if (maybe == e)
+ return 0;
+ if (maybe != e)
+ return 0;
+ if (maybe < e)
+ return 0;
+ if (maybe <= e)
+ return 0;
+ if (maybe > e)
+ return 0;
+ if (maybe >= e)
+ return 0;
+
+ return 1;
+}
diff --git a/test/Sema/tautological-unsigned-zero-compare.c b/test/Sema/tautological-unsigned-zero-compare.c
index 039d8f885e..e0611cb400 100644
--- a/test/Sema/tautological-unsigned-zero-compare.c
+++ b/test/Sema/tautological-unsigned-zero-compare.c
@@ -1,47 +1,370 @@
// RUN: %clang_cc1 -fsyntax-only -DTEST -verify %s
// RUN: %clang_cc1 -fsyntax-only -Wno-tautological-unsigned-zero-compare -verify %s
+// RUN: %clang_cc1 -fsyntax-only -DTEST -verify -x c++ %s
+// RUN: %clang_cc1 -fsyntax-only -Wno-tautological-unsigned-zero-compare -verify -x c++ %s
-unsigned value(void);
+unsigned uvalue(void);
+signed int svalue(void);
-int main() {
- unsigned un = value();
+#define macro(val) val
+#ifdef __cplusplus
+template<typename T>
+void TFunc() {
+ // Make sure that we do warn for normal variables in template functions !
+ unsigned char c = svalue();
#ifdef TEST
+ if (c < 0) // expected-warning {{comparison of unsigned expression < 0 is always false}}
+ return;
+#else
+ if (c < 0)
+ return;
+#endif
+
+ if (c < macro(0))
+ return;
+
+ T v = svalue();
+ if (v < 0)
+ return;
+}
+#endif
+
+int main()
+{
+#ifdef __cplusplus
+ TFunc<unsigned char>();
+ TFunc<unsigned short>();
+#endif
+
+ unsigned un = uvalue();
+
+#ifdef TEST
+ if (un == 0)
+ return 0;
+ if (un != 0)
+ return 0;
if (un < 0) // expected-warning {{comparison of unsigned expression < 0 is always false}}
- return 0;
+ return 0;
+ if (un <= 0)
+ return 0;
+ if (un > 0)
+ return 0;
if (un >= 0) // expected-warning {{comparison of unsigned expression >= 0 is always true}}
- return 0;
+ return 0;
+
+ if (0 == un)
+ return 0;
+ if (0 != un)
+ return 0;
+ if (0 < un)
+ return 0;
if (0 <= un) // expected-warning {{comparison of 0 <= unsigned expression is always true}}
- return 0;
+ return 0;
if (0 > un) // expected-warning {{comparison of 0 > unsigned expression is always false}}
- return 0;
- if (un < 0U) // expected-warning {{comparison of unsigned expression < 0 is always false}}
- return 0;
- if (un >= 0U) // expected-warning {{comparison of unsigned expression >= 0 is always true}}
- return 0;
- if (0U <= un) // expected-warning {{comparison of 0 <= unsigned expression is always true}}
- return 0;
- if (0U > un) // expected-warning {{comparison of 0 > unsigned expression is always false}}
- return 0;
+ return 0;
+ if (0 >= un)
+ return 0;
+
+ if (un == 0UL)
+ return 0;
+ if (un != 0UL)
+ return 0;
+ if (un < 0UL) // expected-warning {{comparison of unsigned expression < 0 is always false}}
+ return 0;
+ if (un <= 0UL)
+ return 0;
+ if (un > 0UL)
+ return 0;
+ if (un >= 0UL) // expected-warning {{comparison of unsigned expression >= 0 is always true}}
+ return 0;
+
+ if (0UL == un)
+ return 0;
+ if (0UL != un)
+ return 0;
+ if (0UL < un)
+ return 0;
+ if (0UL <= un) // expected-warning {{comparison of 0 <= unsigned expression is always true}}
+ return 0;
+ if (0UL > un) // expected-warning {{comparison of 0 > unsigned expression is always false}}
+ return 0;
+ if (0UL >= un)
+ return 0;
#else
// expected-no-diagnostics
+ if (un == 0)
+ return 0;
+ if (un != 0)
+ return 0;
if (un < 0)
- return 0;
+ return 0;
+ if (un <= 0)
+ return 0;
+ if (un > 0)
+ return 0;
if (un >= 0)
- return 0;
+ return 0;
+
+ if (0 == un)
+ return 0;
+ if (0 != un)
+ return 0;
+ if (0 < un)
+ return 0;
if (0 <= un)
- return 0;
+ return 0;
if (0 > un)
- return 0;
- if (un < 0U)
- return 0;
- if (un >= 0U)
- return 0;
- if (0U <= un)
- return 0;
- if (0U > un)
- return 0;
+ return 0;
+ if (0 >= un)
+ return 0;
+
+ if (un == 0UL)
+ return 0;
+ if (un != 0UL)
+ return 0;
+ if (un < 0UL)
+ return 0;
+ if (un <= 0UL)
+ return 0;
+ if (un > 0UL)
+ return 0;
+ if (un >= 0UL)
+ return 0;
+
+ if (0UL == un)
+ return 0;
+ if (0UL != un)
+ return 0;
+ if (0UL < un)
+ return 0;
+ if (0UL <= un)
+ return 0;
+ if (0UL > un)
+ return 0;
+ if (0UL >= un)
+ return 0;
+#endif
+
+
+ signed int a = svalue();
+
+#ifdef TEST
+ if (a == 0)
+ return 0;
+ if (a != 0)
+ return 0;
+ if (a < 0)
+ return 0;
+ if (a <= 0)
+ return 0;
+ if (a > 0)
+ return 0;
+ if (a >= 0)
+ return 0;
+
+ if (0 == a)
+ return 0;
+ if (0 != a)
+ return 0;
+ if (0 < a)
+ return 0;
+ if (0 <= a)
+ return 0;
+ if (0 > a)
+ return 0;
+ if (0 >= a)
+ return 0;
+
+ if (a == 0UL)
+ return 0;
+ if (a != 0UL)
+ return 0;
+ if (a < 0UL) // expected-warning {{comparison of unsigned expression < 0 is always false}}
+ return 0;
+ if (a <= 0UL)
+ return 0;
+ if (a > 0UL)
+ return 0;
+ if (a >= 0UL) // expected-warning {{comparison of unsigned expression >= 0 is always true}}
+ return 0;
+
+ if (0UL == a)
+ return 0;
+ if (0UL != a)
+ return 0;
+ if (0UL < a)
+ return 0;
+ if (0UL <= a) // expected-warning {{comparison of 0 <= unsigned expression is always true}}
+ return 0;
+ if (0UL > a) // expected-warning {{comparison of 0 > unsigned expression is always false}}
+ return 0;
+ if (0UL >= a)
+ return 0;
+#else
+// expected-no-diagnostics
+ if (a == 0)
+ return 0;
+ if (a != 0)
+ return 0;
+ if (a < 0)
+ return 0;
+ if (a <= 0)
+ return 0;
+ if (a > 0)
+ return 0;
+ if (a >= 0)
+ return 0;
+
+ if (0 == a)
+ return 0;
+ if (0 != a)
+ return 0;
+ if (0 < a)
+ return 0;
+ if (0 <= a)
+ return 0;
+ if (0 > a)
+ return 0;
+ if (0 >= a)
+ return 0;
+
+ if (a == 0UL)
+ return 0;
+ if (a != 0UL)
+ return 0;
+ if (a < 0UL)
+ return 0;
+ if (a <= 0UL)
+ return 0;
+ if (a > 0UL)
+ return 0;
+ if (a >= 0UL)
+ return 0;
+
+ if (0UL == a)
+ return 0;
+ if (0UL != a)
+ return 0;
+ if (0UL < a)
+ return 0;
+ if (0UL <= a)
+ return 0;
+ if (0UL > a)
+ return 0;
+ if (0UL >= a)
+ return 0;
#endif
+
+ float fl = 0;
+
+ if (fl == 0)
+ return 0;
+ if (fl != 0)
+ return 0;
+ if (fl < 0)
+ return 0;
+ if (fl <= 0)
+ return 0;
+ if (fl > 0)
+ return 0;
+ if (fl >= 0)
+ return 0;
+
+ if (0 == fl)
+ return 0;
+ if (0 != fl)
+ return 0;
+ if (0 < fl)
+ return 0;
+ if (0 <= fl)
+ return 0;
+ if (0 > fl)
+ return 0;
+ if (0 >= fl)
+ return 0;
+
+ if (fl == 0UL)
+ return 0;
+ if (fl != 0UL)
+ return 0;
+ if (fl < 0UL)
+ return 0;
+ if (fl <= 0UL)
+ return 0;
+ if (fl > 0UL)
+ return 0;
+ if (fl >= 0UL)
+ return 0;
+
+ if (0UL == fl)
+ return 0;
+ if (0UL != fl)
+ return 0;
+ if (0UL < fl)
+ return 0;
+ if (0UL <= fl)
+ return 0;
+ if (0UL > fl)
+ return 0;
+ if (0UL >= fl)
+ return 0;
+
+
+ double dl = 0;
+
+ if (dl == 0)
+ return 0;
+ if (dl != 0)
+ return 0;
+ if (dl < 0)
+ return 0;
+ if (dl <= 0)
+ return 0;
+ if (dl > 0)
+ return 0;
+ if (dl >= 0)
+ return 0;
+
+ if (0 == dl)
+ return 0;
+ if (0 != dl)
+ return 0;
+ if (0 < dl)
+ return 0;
+ if (0 <= dl)
+ return 0;
+ if (0 > dl)
+ return 0;
+ if (0 >= dl)
+ return 0;
+
+ if (dl == 0UL)
+ return 0;
+ if (dl != 0UL)
+ return 0;
+ if (dl < 0UL)
+ return 0;
+ if (dl <= 0UL)
+ return 0;
+ if (dl > 0UL)
+ return 0;
+ if (dl >= 0UL)
+ return 0;
+
+ if (0UL == dl)
+ return 0;
+ if (0UL != dl)
+ return 0;
+ if (0UL < dl)
+ return 0;
+ if (0UL <= dl)
+ return 0;
+ if (0UL > dl)
+ return 0;
+ if (0UL >= dl)
+ return 0;
+
return 1;
}