aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/compare6.c
diff options
context:
space:
mode:
authorRichard Henderson <rth@redhat.com>2002-04-25 19:15:52 -0700
committerRichard Henderson <rth@gcc.gnu.org>2002-04-25 19:15:52 -0700
commit5c5b22838958187f83bf60d0394cc06942796646 (patch)
treed191e51bd4b8889ad81bf2f13318123a238b62bb /gcc/testsuite/gcc.dg/compare6.c
parent28ce94d46b9b885cc01f1649bc545b6978e033d0 (diff)
downloadgcc-5c5b22838958187f83bf60d0394cc06942796646.zip
gcc-5c5b22838958187f83bf60d0394cc06942796646.tar.gz
gcc-5c5b22838958187f83bf60d0394cc06942796646.tar.bz2
re PR c/2098 (compare with unsigned variable - no error reporting)
PR c/2098 * c-common.c (shorten_compare): Simplfy conditions leading to the generation of a warning. * gcc.dg/compare6.c: New. From-SVN: r52778
Diffstat (limited to 'gcc/testsuite/gcc.dg/compare6.c')
-rw-r--r--gcc/testsuite/gcc.dg/compare6.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/compare6.c b/gcc/testsuite/gcc.dg/compare6.c
new file mode 100644
index 0000000..fbeb6a0
--- /dev/null
+++ b/gcc/testsuite/gcc.dg/compare6.c
@@ -0,0 +1,13 @@
+/* PR c/2098 */
+/* Test for a warning on comparison on out-of-range data. */
+/* { dg-do compile { xfail c4x-*-* } } */
+/* { dg-options "-Wall" } */
+
+signed char sc;
+unsigned char uc;
+
+void foo()
+{
+ if (sc == 10000) return; /* { dg-warning "always false" "signed" } */
+ if (uc == 10000) return; /* { dg-warning "always false" "unsigned" } */
+}