diff options
author | Manuel López-Ibáñez <manu@gcc.gnu.org> | 2007-01-05 21:57:01 +0000 |
---|---|---|
committer | Manuel López-Ibáñez <manu@gcc.gnu.org> | 2007-01-05 21:57:01 +0000 |
commit | 59c0753dd31ebc72074a9650182896e0c6f5647a (patch) | |
tree | 6907cbd4435447e2f591dc2ff312abadddf5058a /gcc/testsuite/gcc.dg/multiple-overflow-warn-2.c | |
parent | c2658540a35254dd462e104abf9cf8b7bdb68113 (diff) | |
download | gcc-59c0753dd31ebc72074a9650182896e0c6f5647a.zip gcc-59c0753dd31ebc72074a9650182896e0c6f5647a.tar.gz gcc-59c0753dd31ebc72074a9650182896e0c6f5647a.tar.bz2 |
re PR c/19978 (overflow in expression of constants should not cause multiple warnings)
2007-01-05 Manuel Lopez-Ibanez <manu@gcc.gnu.org>
PR c/19978
* tree.h (TREE_OVERFLOW_P): New.
* c-typeck.c (parser_build_unary_op): Warn only if result
overflowed and operands did not.
(parser_build_binary_op): Likewise.
(convert_for_assignment): Remove redundant overflow_warning.
* c-common.c (overflow_warning): Don't check or set TREE_OVERFLOW.
cp/
* semantics.c (finish_unary_op_expr): Warn only if result
overflowed and operands did not.
testsuite/
* gcc.dg/multiple-overflow-warn-1.c: New.
* gcc.dg/multiple-overflow-warn-2.c: New.
* gcc.dg/overflow-warn-6.c: New.
* g++.dg/warn/multiple-overflow-warn-1.C: New.
From-SVN: r120505
Diffstat (limited to 'gcc/testsuite/gcc.dg/multiple-overflow-warn-2.c')
-rw-r--r-- | gcc/testsuite/gcc.dg/multiple-overflow-warn-2.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/gcc/testsuite/gcc.dg/multiple-overflow-warn-2.c b/gcc/testsuite/gcc.dg/multiple-overflow-warn-2.c new file mode 100644 index 0000000..8a4e9e5 --- /dev/null +++ b/gcc/testsuite/gcc.dg/multiple-overflow-warn-2.c @@ -0,0 +1,12 @@ +/* PR c/19978 : Test for duplicated warnings (binary operators). */ +/* { dg-do compile } */ +/* { dg-options "-std=c99 -Woverflow" } */ + +#include <limits.h> + +int +g1 (void) +{ + return INT_MAX + 1 - INT_MAX; /* { dg-bogus "integer overflow in expression.*integer overflow in expression" } */ + /* { dg-warning "integer overflow in expression" "" { target *-*-* } 10 } */ +} |