diff options
author | rth <rth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-04-26 02:15:52 +0000 |
---|---|---|
committer | rth <rth@138bc75d-0d04-0410-961f-82ee72b054a4> | 2002-04-26 02:15:52 +0000 |
commit | fe5f236657f1802839c8d64b902396bf8cc063ac (patch) | |
tree | d191e51bd4b8889ad81bf2f13318123a238b62bb /gcc/testsuite/gcc.dg/compare6.c | |
parent | c601dd7db3a109db68bbe1e259dda0ea5ad18975 (diff) | |
download | gcc-fe5f236657f1802839c8d64b902396bf8cc063ac.tar.gz |
PR c/2098
* c-common.c (shorten_compare): Simplfy conditions leading to
the generation of a warning.
* gcc.dg/compare6.c: New.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@52778 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/testsuite/gcc.dg/compare6.c')
-rw-r--r-- | gcc/testsuite/gcc.dg/compare6.c | 13 |
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 00000000000..fbeb6a0aedd --- /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" } */ +} |