summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>2002-09-08 03:20:35 +0000
committerrth <rth@138bc75d-0d04-0410-961f-82ee72b054a4>2002-09-08 03:20:35 +0000
commite4d4d9ae14504f986b0ca393bd77b34cfb78acaa (patch)
tree2fe21d185b6128b532ce398c3d0354ca265c03ae
parent5bdbfb1d23c33b86d4611bb5c4f4cfe13d1c3aba (diff)
downloadgcc-e4d4d9ae14504f986b0ca393bd77b34cfb78acaa.tar.gz
* c-typeck.c (c_tree_expr_nonnegative_p): New function.
(build_binary_op): Call c_tree_expr_nonnegative_p rather than tree_expr_nonnegative_p. (build_conditional_expr): Likewise. * c-tree.h (c_tree_expr_nonnegative_p): Declare. * gcc.dg/compare2.c: Remove xfail from cases 10 and 12. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@56927 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog34
-rw-r--r--gcc/c-tree.h1
-rw-r--r--gcc/c-typeck.c27
-rw-r--r--gcc/testsuite/ChangeLog10
-rw-r--r--gcc/testsuite/gcc.dg/compare2.c4
5 files changed, 55 insertions, 21 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 731855fd511..6fc185ae984 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,11 @@
+2002-09-07 Ansgar Esztermann <ansgar@thphy.uni-duesseldorf.de>
+
+ * c-typeck.c (c_tree_expr_nonnegative_p): New function.
+ (build_binary_op): Call c_tree_expr_nonnegative_p rather than
+ tree_expr_nonnegative_p.
+ (build_conditional_expr): Likewise.
+ * c-tree.h (c_tree_expr_nonnegative_p): Declare.
+
2002-09-07 Richard Henderson <rth@redhat.com>
* builtins.def (inf, inff, infl): Mark const.
@@ -53,7 +61,7 @@
Fri Sep 6 13:10:08 2002 Jeffrey A Law (law@redhat.com)
- * pentium.md (pentium-firstvboth): Fix typo.
+ * pentium.md (pentium-firstvboth): Fix typo.
2002-09-06 Dhananjay Deshpande <dhananjayd@kpit.com>
@@ -525,7 +533,7 @@ Tue Sep 3 11:32:14 2002 Nicola Pero <n.pero@mi.flashnet.it>
PR objc/5956:
* objc/objc-act.c (build_typed_selector_reference): Fix typo which
was causing the new selector never to match the existing ones
- (Patch by Alexander Malmberg <alexander@malmberg.org>).
+ (Patch by Alexander Malmberg <alexander@malmberg.org>).
2002-09-03 Graham Stott <graham.stott@btinternet.com>
@@ -834,17 +842,17 @@ Tue Aug 27 23:03:52 2002 Nicola Pero <n.pero@mi.flashnet.it>
already been defined, and emit a warning if not.
2002-08-27 Nick Clifton <nickc@redhat.com>
- Catherine Moore <clm@redhat.com>
- Jim Wilson <wilson@cygnus.com>
-
- * config.gcc: Add v850e-*-* target.
- Add --with-cpu= support for v850.
- * config/v850/lib1funcs.asm: Add v850e callt functions.
- * config/v850/v850.h: Add support for v850e target.
- * config/v850/v850.c: Add functions to support v850e target.
- * config/v850/v850-protos.h: Add prototypes for new functions in v850.c.
- * config/v850/v850.md: Add patterns for v850e instructions.
- * doc/invoke.texi: Document new v850e command line switches.
+ Catherine Moore <clm@redhat.com>
+ Jim Wilson <wilson@cygnus.com>
+
+ * config.gcc: Add v850e-*-* target.
+ Add --with-cpu= support for v850.
+ * config/v850/lib1funcs.asm: Add v850e callt functions.
+ * config/v850/v850.h: Add support for v850e target.
+ * config/v850/v850.c: Add functions to support v850e target.
+ * config/v850/v850-protos.h: Add prototypes for new functions in v850.c.
+ * config/v850/v850.md: Add patterns for v850e instructions.
+ * doc/invoke.texi: Document new v850e command line switches.
Tue Aug 27 18:30:47 2002 J"orn Rennecke <joern.rennecke@superh.com>
Aldy Hernandez <aldyh at redhat dot com>
diff --git a/gcc/c-tree.h b/gcc/c-tree.h
index aa2fda5d5ea..531cc284559 100644
--- a/gcc/c-tree.h
+++ b/gcc/c-tree.h
@@ -268,6 +268,7 @@ extern tree build_array_ref PARAMS ((tree, tree));
extern tree build_external_ref PARAMS ((tree, int));
extern tree parser_build_binary_op PARAMS ((enum tree_code,
tree, tree));
+extern int c_tree_expr_nonnegative_p PARAMS ((tree));
extern void readonly_warning PARAMS ((tree, const char *));
extern tree build_conditional_expr PARAMS ((tree, tree, tree));
extern tree build_compound_expr PARAMS ((tree));
diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c
index ac77bc234c7..4c6c8bacdf8 100644
--- a/gcc/c-typeck.c
+++ b/gcc/c-typeck.c
@@ -2463,7 +2463,7 @@ build_binary_op (code, orig_op0, orig_op1, convert_p)
constant expression involving such literals or a
conditional expression involving such literals)
and it is non-negative. */
- if (tree_expr_nonnegative_p (sop))
+ if (c_tree_expr_nonnegative_p (sop))
/* OK */;
/* Do not warn if the comparison is an equality operation,
the unsigned quantity is an integral constant, and it
@@ -2579,6 +2579,27 @@ build_binary_op (code, orig_op0, orig_op1, convert_p)
}
}
+
+/* Return true if `t' is known to be non-negative. */
+
+int
+c_tree_expr_nonnegative_p (t)
+ tree t;
+{
+ if (TREE_CODE (t) == STMT_EXPR)
+ {
+ t=COMPOUND_BODY (STMT_EXPR_STMT (t));
+
+ /* Find the last statement in the chain, ignoring the final
+ * scope statement */
+ while (TREE_CHAIN (t) != NULL_TREE
+ && TREE_CODE (TREE_CHAIN (t)) != SCOPE_STMT)
+ t=TREE_CHAIN (t);
+ return tree_expr_nonnegative_p (TREE_OPERAND (t, 0));
+ }
+ return tree_expr_nonnegative_p (t);
+}
+
/* Return a tree for the difference of pointers OP0 and OP1.
The resulting tree has type int. */
@@ -3406,8 +3427,8 @@ build_conditional_expr (ifexp, op1, op2)
/* Do not warn if the signed quantity is an unsuffixed
integer literal (or some static constant expression
involving such literals) and it is non-negative. */
- else if ((unsigned_op2 && tree_expr_nonnegative_p (op1))
- || (unsigned_op1 && tree_expr_nonnegative_p (op2)))
+ else if ((unsigned_op2 && c_tree_expr_nonnegative_p (op1))
+ || (unsigned_op1 && c_tree_expr_nonnegative_p (op2)))
/* OK */;
else
warning ("signed and unsigned type in conditional expression");
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 18696d09e52..d382457b3bc 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2002-09-07 Ansgar Esztermann <ansgar@thphy.uni-duesseldorf.de>
+
+ * gcc.dg/compare2.c: Remove xfail from cases 10 and 12.
+
2002-09-05 Ziemowit Laski <zlaski@apple.com>
* objc.dg/proto-lossage-1.m: New test.
@@ -80,7 +84,7 @@ Tue Aug 27 22:23:22 2002 Nicola Pero <n.pero@mi.flashnet.it>
2002-08-26 Ziemowit Laski <zlaski@apple.com>
- * objc.dg/super-class-2.m: New test.
+ * objc.dg/super-class-2.m: New test.
2002-08-24 Matt Austern <austern@apple.com>
@@ -186,7 +190,7 @@ Tue Aug 27 22:23:22 2002 Nicola Pero <n.pero@mi.flashnet.it>
2002-08-06 Aldy Hernandez <aldyh@redhat.com>
- * testsuite/gcc.dg/tls/diag-3.c: New.
+ * testsuite/gcc.dg/tls/diag-3.c: New.
2002-08-07 Gabriel Dos Reis <gdr@nerim.net>
@@ -231,7 +235,7 @@ Tue Aug 27 22:23:22 2002 Nicola Pero <n.pero@mi.flashnet.it>
2002-08-01 Benjamin Kosnik <bkoz@redhat.com>
- * g++.old-deja/g++.abi/ptrflags.C (expect): Change
+ * g++.old-deja/g++.abi/ptrflags.C (expect): Change
__qualifier_flags to __flags.
2002-07-31 Mark Mitchell <mark@codesourcery.com>
diff --git a/gcc/testsuite/gcc.dg/compare2.c b/gcc/testsuite/gcc.dg/compare2.c
index a33e4aa2955..0625eb9c3f6 100644
--- a/gcc/testsuite/gcc.dg/compare2.c
+++ b/gcc/testsuite/gcc.dg/compare2.c
@@ -26,11 +26,11 @@ void f(int x, unsigned int y)
/* Statement expression. */
x > ({tf; 64;}); /* { dg-bogus "signed and unsigned" "case 9" } */
- y > ({tf; 64;}); /* { dg-bogus "signed and unsigned" "case 10" { xfail *-*-* } } */
+ y > ({tf; 64;}); /* { dg-bogus "signed and unsigned" "case 10" } */
/* Statement expression with recursive ?: . */
x > ({tf; tf?64:(tf?128:256);}); /* { dg-bogus "signed and unsigned" "case 11" } */
- y > ({tf; tf?64:(tf?128:256);}); /* { dg-bogus "signed and unsigned" "case 12" { xfail *-*-* } } */
+ y > ({tf; tf?64:(tf?128:256);}); /* { dg-bogus "signed and unsigned" "case 12" } */
/* Statement expression with signed ?:. */
x > ({tf; tf?64:-1;}); /* { dg-bogus "signed and unsigned" "case 13" } */