This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[tree-ssa] fix g++.dg/template/warn1.C
- From: Richard Henderson <rth at twiddle dot net>
- To: gcc-patches at gcc dot gnu dot org
- Date: Tue, 30 Sep 2003 14:08:48 -0700
- Subject: [tree-ssa] fix g++.dg/template/warn1.C
Problem here is that for
i ? i + 1 : i + 2; // { dg-error "operand of" "" }
We'd issue three warnings instead of two, as with mainline.
The code in convert_to_void warns for the two sub-expressions,
constructs a COND_EXPR with void type, as you'd expect, but
then gimplification goes and warns about it again.
r~
* c-simplify.c (gimplify_expr_stmt): Don't warn for any statement
with void result type.
Index: c-simplify.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/c-simplify.c,v
retrieving revision 1.1.4.71
diff -c -p -d -r1.1.4.71 c-simplify.c
*** c-simplify.c 10 Sep 2003 21:31:07 -0000 1.1.4.71
--- c-simplify.c 30 Sep 2003 20:51:25 -0000
*************** gimplify_expr_stmt (tree *stmt_p)
*** 459,467 ****
{
if (!TREE_SIDE_EFFECTS (stmt))
{
! if (!IS_EMPTY_STMT (stmt)
! && !(TREE_CODE (stmt) == CONVERT_EXPR
! && VOID_TYPE_P (TREE_TYPE (stmt))))
warning ("statement with no effect");
}
else if (warn_unused_value)
--- 459,465 ----
{
if (!TREE_SIDE_EFFECTS (stmt))
{
! if (!IS_EMPTY_STMT (stmt) && !VOID_TYPE_P (TREE_TYPE (stmt)))
warning ("statement with no effect");
}
else if (warn_unused_value)