aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite
diff options
context:
space:
mode:
authorManuel López-Ibáñez <manu@gcc.gnu.org>2007-05-20 20:29:55 +0000
committerManuel López-Ibáñez <manu@gcc.gnu.org>2007-05-20 20:29:55 +0000
commitf6aa72dd497916b60e7a3c29e235241dadba3274 (patch)
tree90312ab1a9121fa6e7864a7b15bdaf3260ab1b8b /gcc/testsuite
parentda5a2efd39b67a36c4e70f059ffbbb6103606f3e (diff)
downloadgcc-f6aa72dd497916b60e7a3c29e235241dadba3274.zip
gcc-f6aa72dd497916b60e7a3c29e235241dadba3274.tar.gz
gcc-f6aa72dd497916b60e7a3c29e235241dadba3274.tar.bz2
re PR middle-end/7651 (Define -Wextra strictly in terms of other warning flags)
2007-05-20 Manuel Lopez-Ibanez <manu@gcc.gnu.org> PR middle-end/7651 PR c++/11856 PR c/12963 PR c/23587 PR other/29694 * c.opt (Wtype-limits): New. * doc/invoke.texi (Wtype-limits): Document it. (Wextra): Enabled by -Wextra. * c-opts.c (c_common_post_options): Enabled by -Wextra. * c-common.c (shorten_compare): Warn with Wtype-limits. testsuite/ * gcc.dg/compare6.c: Replace Wall with Wtype-limits. * gcc.dg/Wtype-limits.c: New. * gcc.dg/Wtype-limits-Wextra.c: New. * gcc.dg/Wtype-limits-no.c: New. * g++.dg/warn/Wtype-limits.C: New. * g++.dg/warn/Wtype-limits-Wextra.C: New. * g++.dg/warn/Wtype-limits-no.C: New. From-SVN: r124875
Diffstat (limited to 'gcc/testsuite')
-rw-r--r--gcc/testsuite/ChangeLog15
-rw-r--r--gcc/testsuite/g++.dg/warn/Wtype-limits-Wextra.C84
-rw-r--r--gcc/testsuite/g++.dg/warn/Wtype-limits-no.C84
-rw-r--r--gcc/testsuite/g++.dg/warn/Wtype-limits.C84
-rw-r--r--gcc/testsuite/gcc.dg/Wtype-limits-Wextra.c66
-rw-r--r--gcc/testsuite/gcc.dg/Wtype-limits-no.c66
-rw-r--r--gcc/testsuite/gcc.dg/Wtype-limits.c66
-rw-r--r--gcc/testsuite/gcc.dg/compare6.c2
8 files changed, 466 insertions, 1 deletions
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 0b7b2c0..db0a0d5 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,18 @@
+2007-05-20 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
+
+ PR middle-end/7651
+ PR c++/11856
+ PR c/12963
+ PR c/23587
+ PR other/29694
+ * gcc.dg/compare6.c: Replace Wall with Wtype-limits.
+ * gcc.dg/Wtype-limits.c: New.
+ * gcc.dg/Wtype-limits-Wextra.c: New.
+ * gcc.dg/Wtype-limits-no.c: New.
+ * g++.dg/warn/Wtype-limits.C: New.
+ * g++.dg/warn/Wtype-limits-Wextra.C: New.
+ * g++.dg/warn/Wtype-limits-no.C: New.
+
2006-05-20 Uros Bizjak <ubizjak@gmail.com>
* gcc.target/i386/sse-vect-types.c: Revert 'Use "-msse"
diff --git a/gcc/testsuite/g++.dg/warn/Wtype-limits-Wextra.C b/gcc/testsuite/g++.dg/warn/Wtype-limits-Wextra.C
new file mode 100644
index 0000000..9cbdbe5
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wtype-limits-Wextra.C
@@ -0,0 +1,84 @@
+/* Test that -Wtype-limits is enabled by -Wextra. */
+/* { dg-do compile } */
+/* { dg-options "-Wextra" } */
+extern void assert (int);
+
+void a (unsigned char x)
+{
+ if (x < 0) return;/* { dg-warning "comparison is always false due to limited range of data type" } */
+ if (x >= 0) return;/* { dg-warning "comparison is always true due to limited range of data type" } */
+ if (0 > x) return;/* { dg-warning "comparison is always false due to limited range of data type" } */
+ if (0 <= x) return;/* { dg-warning "comparison is always true due to limited range of data type" } */
+ if (x <= 255) /* { dg-warning "comparison is always true due to limited range of data type" } */
+ return;
+ if (255 >= x) /* { dg-warning "comparison is always true due to limited range of data type" } */
+ return;
+ if ((int)x <= 255) /* { dg-bogus "comparison is always true due to limited range of data type" "" { xfail *-*-* } 16 } */
+ return;
+ if (255 >= (unsigned char) 1)
+ return;
+
+}
+
+void b (unsigned short x)
+{
+ if (x < 0) return;/* { dg-warning "comparison is always false due to limited range of data type" } */
+ if (x >= 0) return;/* { dg-warning "comparison is always true due to limited range of data type" } */
+ if (0 > x) return;/* { dg-warning "comparison is always false due to limited range of data type" } */
+ if (0 <= x) return;/* { dg-warning "comparison is always true due to limited range of data type" } */
+}
+
+void c (unsigned int x)
+{
+ if (x < 0) return;/* { dg-warning "comparison of unsigned expression < 0 is always false" } */
+ if (x >= 0) return;/* { dg-warning "comparison of unsigned expression >= 0 is always true" } */
+ if (0 > x) return;/* { dg-warning "comparison of unsigned expression < 0 is always false" } */
+ if (0 <= x) return;/* { dg-warning "comparison of unsigned expression >= 0 is always true" } */
+ if (1U >= 0) return;
+ if (1U < 0) return;
+ if (0 <= 1U) return;
+ if (0 > 1U) return;
+}
+
+void d (unsigned long x)
+{
+ if (x < 0) return;/* { dg-warning "comparison of unsigned expression < 0 is always false" } */
+ if (x >= 0) return;/* { dg-warning "comparison of unsigned expression >= 0 is always true" } */
+ if (0 > x) return;/* { dg-warning "comparison of unsigned expression < 0 is always false" } */
+ if (0 <= x) return;/* { dg-warning "comparison of unsigned expression >= 0 is always true" } */
+}
+
+void e (unsigned long long x)
+{
+ if (x < 0) return;/* { dg-warning "comparison of unsigned expression < 0 is always false" } */
+ if (x >= 0) return;/* { dg-warning "comparison of unsigned expression >= 0 is always true" } */
+ if (0 > x) return;/* { dg-warning "comparison of unsigned expression < 0 is always false" } */
+ if (0 <= x) return;/* { dg-warning "comparison of unsigned expression >= 0 is always true" } */
+}
+
+int test (int x)
+{
+ if ((long long)x <= 0x123456789ABCLL) /* { dg-bogus "comparison is always true due to limited range of data type" "" { xfail *-*-* } 61 } */
+ return 1;
+ else
+ return 0;
+}
+
+template <typename Int, Int D>
+void f(Int x) {
+ assert(0 <= x and x <= D); // { dg-warning "comparison is always true due to limited range of data type" }
+}
+
+int ff(void) {
+ f<unsigned char, 2>(5);
+ f<signed char, 2>(5);
+}
+
+template <typename Int, Int D>
+void g(void) {
+ assert(0 <= D);
+}
+int gg(void) {
+ g<unsigned char, 2>();
+}
+
diff --git a/gcc/testsuite/g++.dg/warn/Wtype-limits-no.C b/gcc/testsuite/g++.dg/warn/Wtype-limits-no.C
new file mode 100644
index 0000000..5040e26
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wtype-limits-no.C
@@ -0,0 +1,84 @@
+/* Test disabling -Wtype-limits. */
+/* { dg-do compile } */
+/* { dg-options "-Wextra -Wno-type-limits" } */
+extern void assert (int);
+
+void a (unsigned char x)
+{
+ if (x < 0) return;/* { dg-bogus "comparison is always false due to limited range of data type" } */
+ if (x >= 0) return;/* { dg-bogus "comparison is always true due to limited range of data type" } */
+ if (0 > x) return;/* { dg-bogus "comparison is always false due to limited range of data type" } */
+ if (0 <= x) return;/* { dg-bogus "comparison is always true due to limited range of data type" } */
+ if (x <= 255) /* { dg-bogus "comparison is always true due to limited range of data type" } */
+ return;
+ if (255 >= x) /* { dg-bogus "comparison is always true due to limited range of data type" } */
+ return;
+ if ((int)x <= 255)
+ return;
+ if (255 >= (unsigned char) 1)
+ return;
+
+}
+
+void b (unsigned short x)
+{
+ if (x < 0) return;/* { dg-bogus "comparison is always false due to limited range of data type" } */
+ if (x >= 0) return;/* { dg-bogus "comparison is always true due to limited range of data type" } */
+ if (0 > x) return;/* { dg-bogus "comparison is always false due to limited range of data type" } */
+ if (0 <= x) return;/* { dg-bogus "comparison is always true due to limited range of data type" } */
+}
+
+void c (unsigned int x)
+{
+ if (x < 0) return;/* { dg-bogus "comparison of unsigned expression < 0 is always false" } */
+ if (x >= 0) return;/* { dg-bogus "comparison of unsigned expression >= 0 is always true" } */
+ if (0 > x) return;/* { dg-bogus "comparison of unsigned expression < 0 is always false" } */
+ if (0 <= x) return;/* { dg-bogus "comparison of unsigned expression >= 0 is always true" } */
+ if (1U >= 0) return;
+ if (1U < 0) return;
+ if (0 <= 1U) return;
+ if (0 > 1U) return;
+}
+
+void d (unsigned long x)
+{
+ if (x < 0) return;/* { dg-bogus "comparison of unsigned expression < 0 is always false" } */
+ if (x >= 0) return;/* { dg-bogus "comparison of unsigned expression >= 0 is always true" } */
+ if (0 > x) return;/* { dg-bogus "comparison of unsigned expression < 0 is always false" } */
+ if (0 <= x) return;/* { dg-bogus "comparison of unsigned expression >= 0 is always true" } */
+}
+
+void e (unsigned long long x)
+{
+ if (x < 0) return;/* { dg-bogus "comparison of unsigned expression < 0 is always false" } */
+ if (x >= 0) return;/* { dg-bogus "comparison of unsigned expression >= 0 is always true" } */
+ if (0 > x) return;/* { dg-bogus "comparison of unsigned expression < 0 is always false" } */
+ if (0 <= x) return;/* { dg-bogus "comparison of unsigned expression >= 0 is always true" } */
+}
+
+int test (int x)
+{
+ if ((long long)x <= 0x123456789ABCLL) /* { dg-bogus "comparison is always true due to limited range of data type" } */
+ return 1;
+ else
+ return 0;
+}
+
+template <typename Int, Int D>
+void f(Int x) {
+ assert(0 <= x and x <= D); // { dg-bogus "comparison is always true due to limited range of data type" }
+}
+
+int ff(void) {
+ f<unsigned char, 2>(5);
+ f<signed char, 2>(5);
+}
+
+template <typename Int, Int D>
+void g(void) {
+ assert(0 <= D);
+}
+int gg(void) {
+ g<unsigned char, 2>();
+}
+
diff --git a/gcc/testsuite/g++.dg/warn/Wtype-limits.C b/gcc/testsuite/g++.dg/warn/Wtype-limits.C
new file mode 100644
index 0000000..814c2a8
--- /dev/null
+++ b/gcc/testsuite/g++.dg/warn/Wtype-limits.C
@@ -0,0 +1,84 @@
+/* { dg-do compile } */
+/* { dg-options "-Wtype-limits" } */
+
+extern void assert (int);
+
+void a (unsigned char x)
+{
+ if (x < 0) return;/* { dg-warning "comparison is always false due to limited range of data type" } */
+ if (x >= 0) return;/* { dg-warning "comparison is always true due to limited range of data type" } */
+ if (0 > x) return;/* { dg-warning "comparison is always false due to limited range of data type" } */
+ if (0 <= x) return;/* { dg-warning "comparison is always true due to limited range of data type" } */
+ if (x <= 255) /* { dg-warning "comparison is always true due to limited range of data type" } */
+ return;
+ if (255 >= x) /* { dg-warning "comparison is always true due to limited range of data type" } */
+ return;
+ if ((int)x <= 255) /* { dg-bogus "comparison is always true due to limited range of data type" "" { xfail *-*-* } 16 } */
+ return;
+ if (255 >= (unsigned char) 1)
+ return;
+
+}
+
+void b (unsigned short x)
+{
+ if (x < 0) return;/* { dg-warning "comparison is always false due to limited range of data type" } */
+ if (x >= 0) return;/* { dg-warning "comparison is always true due to limited range of data type" } */
+ if (0 > x) return;/* { dg-warning "comparison is always false due to limited range of data type" } */
+ if (0 <= x) return;/* { dg-warning "comparison is always true due to limited range of data type" } */
+}
+
+void c (unsigned int x)
+{
+ if (x < 0) return;/* { dg-warning "comparison of unsigned expression < 0 is always false" } */
+ if (x >= 0) return;/* { dg-warning "comparison of unsigned expression >= 0 is always true" } */
+ if (0 > x) return;/* { dg-warning "comparison of unsigned expression < 0 is always false" } */
+ if (0 <= x) return;/* { dg-warning "comparison of unsigned expression >= 0 is always true" } */
+ if (1U >= 0) return;
+ if (1U < 0) return;
+ if (0 <= 1U) return;
+ if (0 > 1U) return;
+}
+
+void d (unsigned long x)
+{
+ if (x < 0) return;/* { dg-warning "comparison of unsigned expression < 0 is always false" } */
+ if (x >= 0) return;/* { dg-warning "comparison of unsigned expression >= 0 is always true" } */
+ if (0 > x) return;/* { dg-warning "comparison of unsigned expression < 0 is always false" } */
+ if (0 <= x) return;/* { dg-warning "comparison of unsigned expression >= 0 is always true" } */
+}
+
+void e (unsigned long long x)
+{
+ if (x < 0) return;/* { dg-warning "comparison of unsigned expression < 0 is always false" } */
+ if (x >= 0) return;/* { dg-warning "comparison of unsigned expression >= 0 is always true" } */
+ if (0 > x) return;/* { dg-warning "comparison of unsigned expression < 0 is always false" } */
+ if (0 <= x) return;/* { dg-warning "comparison of unsigned expression >= 0 is always true" } */
+}
+
+int test (int x)
+{
+ if ((long long)x <= 0x123456789ABCLL) /* { dg-bogus "comparison is always true due to limited range of data type" "" { xfail *-*-* } 61 } */
+ return 1;
+ else
+ return 0;
+}
+
+template <typename Int, Int D>
+void f(Int x) {
+ assert(0 <= x and x <= D); // { dg-warning "comparison is always true due to limited range of data type" }
+}
+
+int ff(void) {
+ f<unsigned char, 2>(5);
+ f<signed char, 2>(5);
+}
+
+template <typename Int, Int D>
+void g(void) {
+ assert(0 <= D);
+}
+int gg(void) {
+ g<unsigned char, 2>();
+}
+
diff --git a/gcc/testsuite/gcc.dg/Wtype-limits-Wextra.c b/gcc/testsuite/gcc.dg/Wtype-limits-Wextra.c
new file mode 100644
index 0000000..ae13e73
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Wtype-limits-Wextra.c
@@ -0,0 +1,66 @@
+/* Test that -Wtype-limits is enabled by -Wextra */
+/* { dg-do compile } */
+/* { dg-options "-Wextra" } */
+
+
+void a (unsigned char x)
+{
+ if (x < 0) return;/* { dg-warning "comparison is always false due to limited range of data type" } */
+ if (x >= 0) return;/* { dg-warning "comparison is always true due to limited range of data type" } */
+ if (0 > x) return;/* { dg-warning "comparison is always false due to limited range of data type" } */
+ if (0 <= x) return;/* { dg-warning "comparison is always true due to limited range of data type" } */
+ if (x <= 255) /* { dg-warning "comparison is always true due to limited range of data type" } */
+ return;
+ if (255 >= x) /* { dg-warning "comparison is always true due to limited range of data type" } */
+ return;
+ if ((int)x <= 255) /* { dg-bogus "comparison is always true due to limited range of data type" "" { xfail *-*-* } 16 } */
+ return;
+ if (255 >= (unsigned char) 1)
+ return;
+
+}
+
+void b (unsigned short x)
+{
+ if (x < 0) return;/* { dg-warning "comparison is always false due to limited range of data type" } */
+ if (x >= 0) return;/* { dg-warning "comparison is always true due to limited range of data type" } */
+ if (0 > x) return;/* { dg-warning "comparison is always false due to limited range of data type" } */
+ if (0 <= x) return;/* { dg-warning "comparison is always true due to limited range of data type" } */
+}
+
+void c (unsigned int x)
+{
+ if (x < 0) return;/* { dg-warning "comparison of unsigned expression < 0 is always false" } */
+ if (x >= 0) return;/* { dg-warning "comparison of unsigned expression >= 0 is always true" } */
+ if (0 > x) return;/* { dg-warning "comparison of unsigned expression < 0 is always false" } */
+ if (0 <= x) return;/* { dg-warning "comparison of unsigned expression >= 0 is always true" } */
+ if (1U >= 0) return;
+ if (1U < 0) return;
+ if (0 <= 1U) return;
+ if (0 > 1U) return;
+}
+
+void d (unsigned long x)
+{
+ if (x < 0) return;/* { dg-warning "comparison of unsigned expression < 0 is always false" } */
+ if (x >= 0) return;/* { dg-warning "comparison of unsigned expression >= 0 is always true" } */
+ if (0 > x) return;/* { dg-warning "comparison of unsigned expression < 0 is always false" } */
+ if (0 <= x) return;/* { dg-warning "comparison of unsigned expression >= 0 is always true" } */
+}
+
+void e (unsigned long long x)
+{
+ if (x < 0) return;/* { dg-warning "comparison of unsigned expression < 0 is always false" } */
+ if (x >= 0) return;/* { dg-warning "comparison of unsigned expression >= 0 is always true" } */
+ if (0 > x) return;/* { dg-warning "comparison of unsigned expression < 0 is always false" } */
+ if (0 <= x) return;/* { dg-warning "comparison of unsigned expression >= 0 is always true" } */
+}
+
+int test (int x)
+{
+ if ((long long)x <= 0x123456789ABCLL) /* { dg-bogus "comparison is always true due to limited range of data type" "" { xfail *-*-* } 61 } */
+ return 1;
+ else
+ return 0;
+}
+
diff --git a/gcc/testsuite/gcc.dg/Wtype-limits-no.c b/gcc/testsuite/gcc.dg/Wtype-limits-no.c
new file mode 100644
index 0000000..2af909a
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Wtype-limits-no.c
@@ -0,0 +1,66 @@
+/* Test disabling -Wtype-limits */
+/* { dg-do compile } */
+/* { dg-options "-Wextra -Wno-type-limits" } */
+
+
+void a (unsigned char x)
+{
+ if (x < 0) return;/* { dg-bogus "comparison is always false due to limited range of data type" } */
+ if (x >= 0) return;/* { dg-bogus "comparison is always true due to limited range of data type" } */
+ if (0 > x) return;/* { dg-bogus "comparison is always false due to limited range of data type" } */
+ if (0 <= x) return;/* { dg-bogus "comparison is always true due to limited range of data type" } */
+ if (x <= 255) /* { dg-bogus "comparison is always true due to limited range of data type" } */
+ return;
+ if (255 >= x) /* { dg-bogus "comparison is always true due to limited range of data type" } */
+ return;
+ if ((int)x <= 255)
+ return;
+ if (255 >= (unsigned char) 1)
+ return;
+
+}
+
+void b (unsigned short x)
+{
+ if (x < 0) return;/* { dg-bogus "comparison is always false due to limited range of data type" } */
+ if (x >= 0) return;/* { dg-bogus "comparison is always true due to limited range of data type" } */
+ if (0 > x) return;/* { dg-bogus "comparison is always false due to limited range of data type" } */
+ if (0 <= x) return;/* { dg-bogus "comparison is always true due to limited range of data type" } */
+}
+
+void c (unsigned int x)
+{
+ if (x < 0) return;/* { dg-bogus "comparison of unsigned expression < 0 is always false" } */
+ if (x >= 0) return;/* { dg-bogus "comparison of unsigned expression >= 0 is always true" } */
+ if (0 > x) return;/* { dg-bogus "comparison of unsigned expression < 0 is always false" } */
+ if (0 <= x) return;/* { dg-bogus "comparison of unsigned expression >= 0 is always true" } */
+ if (1U >= 0) return;
+ if (1U < 0) return;
+ if (0 <= 1U) return;
+ if (0 > 1U) return;
+}
+
+void d (unsigned long x)
+{
+ if (x < 0) return;/* { dg-bogus "comparison of unsigned expression < 0 is always false" } */
+ if (x >= 0) return;/* { dg-bogus "comparison of unsigned expression >= 0 is always true" } */
+ if (0 > x) return;/* { dg-bogus "comparison of unsigned expression < 0 is always false" } */
+ if (0 <= x) return;/* { dg-bogus "comparison of unsigned expression >= 0 is always true" } */
+}
+
+void e (unsigned long long x)
+{
+ if (x < 0) return;/* { dg-bogus "comparison of unsigned expression < 0 is always false" } */
+ if (x >= 0) return;/* { dg-bogus "comparison of unsigned expression >= 0 is always true" } */
+ if (0 > x) return;/* { dg-bogus "comparison of unsigned expression < 0 is always false" } */
+ if (0 <= x) return;/* { dg-bogus "comparison of unsigned expression >= 0 is always true" } */
+}
+
+int test (int x)
+{
+ if ((long long)x <= 0x123456789ABCLL)
+ return 1;
+ else
+ return 0;
+}
+
diff --git a/gcc/testsuite/gcc.dg/Wtype-limits.c b/gcc/testsuite/gcc.dg/Wtype-limits.c
new file mode 100644
index 0000000..64e7da6
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/Wtype-limits.c
@@ -0,0 +1,66 @@
+/* { dg-do compile } */
+/* { dg-options "-Wtype-limits" } */
+
+
+
+void a (unsigned char x)
+{
+ if (x < 0) return;/* { dg-warning "comparison is always false due to limited range of data type" } */
+ if (x >= 0) return;/* { dg-warning "comparison is always true due to limited range of data type" } */
+ if (0 > x) return;/* { dg-warning "comparison is always false due to limited range of data type" } */
+ if (0 <= x) return;/* { dg-warning "comparison is always true due to limited range of data type" } */
+ if (x <= 255) /* { dg-warning "comparison is always true due to limited range of data type" } */
+ return;
+ if (255 >= x) /* { dg-warning "comparison is always true due to limited range of data type" } */
+ return;
+ if ((int)x <= 255) /* { dg-bogus "comparison is always true due to limited range of data type" "" { xfail *-*-* } 16 } */
+ return;
+ if (255 >= (unsigned char) 1)
+ return;
+
+}
+
+void b (unsigned short x)
+{
+ if (x < 0) return;/* { dg-warning "comparison is always false due to limited range of data type" } */
+ if (x >= 0) return;/* { dg-warning "comparison is always true due to limited range of data type" } */
+ if (0 > x) return;/* { dg-warning "comparison is always false due to limited range of data type" } */
+ if (0 <= x) return;/* { dg-warning "comparison is always true due to limited range of data type" } */
+}
+
+void c (unsigned int x)
+{
+ if (x < 0) return;/* { dg-warning "comparison of unsigned expression < 0 is always false" } */
+ if (x >= 0) return;/* { dg-warning "comparison of unsigned expression >= 0 is always true" } */
+ if (0 > x) return;/* { dg-warning "comparison of unsigned expression < 0 is always false" } */
+ if (0 <= x) return;/* { dg-warning "comparison of unsigned expression >= 0 is always true" } */
+ if (1U >= 0) return;
+ if (1U < 0) return;
+ if (0 <= 1U) return;
+ if (0 > 1U) return;
+}
+
+void d (unsigned long x)
+{
+ if (x < 0) return;/* { dg-warning "comparison of unsigned expression < 0 is always false" } */
+ if (x >= 0) return;/* { dg-warning "comparison of unsigned expression >= 0 is always true" } */
+ if (0 > x) return;/* { dg-warning "comparison of unsigned expression < 0 is always false" } */
+ if (0 <= x) return;/* { dg-warning "comparison of unsigned expression >= 0 is always true" } */
+}
+
+void e (unsigned long long x)
+{
+ if (x < 0) return;/* { dg-warning "comparison of unsigned expression < 0 is always false" } */
+ if (x >= 0) return;/* { dg-warning "comparison of unsigned expression >= 0 is always true" } */
+ if (0 > x) return;/* { dg-warning "comparison of unsigned expression < 0 is always false" } */
+ if (0 <= x) return;/* { dg-warning "comparison of unsigned expression >= 0 is always true" } */
+}
+
+int test (int x)
+{
+ if ((long long)x <= 0x123456789ABCLL) /* { dg-bogus "comparison is always true due to limited range of data type" "" { xfail *-*-* } 61 } */
+ return 1;
+ else
+ return 0;
+}
+
diff --git a/gcc/testsuite/gcc.dg/compare6.c b/gcc/testsuite/gcc.dg/compare6.c
index fbeb6a0..72f5020 100644
--- a/gcc/testsuite/gcc.dg/compare6.c
+++ b/gcc/testsuite/gcc.dg/compare6.c
@@ -1,7 +1,7 @@
/* PR c/2098 */
/* Test for a warning on comparison on out-of-range data. */
/* { dg-do compile { xfail c4x-*-* } } */
-/* { dg-options "-Wall" } */
+/* { dg-options "-Wtype-limits" } */
signed char sc;
unsigned char uc;