Commit 54c93c30 by Ansgar Esztermann Committed by Richard Henderson

c-typeck.c (c_tree_expr_nonnegative_p): New function.

        * 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.

From-SVN: r56927
parent 3aa4cad7
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>
......
......@@ -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));
......
......@@ -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");
......
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>
......
......@@ -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" } */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment