From: Richard Henderson Date: Sun, 12 Sep 2004 21:36:50 +0000 (-0700) Subject: re PR c++/16254 (ICE in lower_stmt, at gimple-low.c:205) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=373c0e7f04097a50d480846786894883adbf5e45;p=gcc.git re PR c++/16254 (ICE in lower_stmt, at gimple-low.c:205) PR c++/16254 * fold-const.c (fold) : Remove. * tree.c, tree.h (has_cleanups): Remove. cp/ * semantics.c (maybe_cleanup_point_expr): Don't call fold. * typeck.c (condition_conversion): Likewise. From-SVN: r87407 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 59d386e5318..95f15457f31 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2004-09-12 Richard Henderson + + PR c++/16254 + * fold-const.c (fold) : Remove. + * tree.c, tree.h (has_cleanups): Remove. + 2004-09-12 Zdenek Dvorak * tree-ssa-loop-manip.c (split_loop_exit_edge): Handle non-ssaname diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index c8ba24d4960..37f08119566 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2004-09-12 Richard Henderson + + PR c++/16254 + * semantics.c (maybe_cleanup_point_expr): Don't call fold. + * typeck.c (condition_conversion): Likewise. + 2004-09-11 Richard Henderson PR c++/17404 diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c index bdf1439a9d3..1ea97a0aa86 100644 --- a/gcc/cp/semantics.c +++ b/gcc/cp/semantics.c @@ -358,7 +358,7 @@ static tree maybe_cleanup_point_expr (tree expr) { if (!processing_template_decl && stmts_are_full_exprs_p ()) - expr = fold (build1 (CLEANUP_POINT_EXPR, TREE_TYPE (expr), expr)); + expr = build1 (CLEANUP_POINT_EXPR, TREE_TYPE (expr), expr); return expr; } diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index 77fd20af6c9..2169bad472f 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -3659,7 +3659,7 @@ condition_conversion (tree expr) if (processing_template_decl) return expr; t = perform_implicit_conversion (boolean_type_node, expr); - t = fold (build1 (CLEANUP_POINT_EXPR, boolean_type_node, t)); + t = build1 (CLEANUP_POINT_EXPR, boolean_type_node, t); return t; } diff --git a/gcc/fold-const.c b/gcc/fold-const.c index 31bf7fd649f..972f276d59c 100644 --- a/gcc/fold-const.c +++ b/gcc/fold-const.c @@ -8946,49 +8946,6 @@ fold (tree expr) TREE_OPERAND (arg0, 1))))); return t; - case CLEANUP_POINT_EXPR: - /* Pull arithmetic ops out of the CLEANUP_POINT_EXPR where - appropriate. */ - if (! has_cleanups (arg0)) - return TREE_OPERAND (t, 0); - - { - enum tree_code code0 = TREE_CODE (arg0); - int kind0 = TREE_CODE_CLASS (code0); - - if (kind0 == '1' || code0 == TRUTH_NOT_EXPR) - { - tree arg00 = TREE_OPERAND (arg0, 0); - return fold (build1 (code0, type, - fold (build1 (CLEANUP_POINT_EXPR, - TREE_TYPE (arg00), arg00)))); - } - - if (kind0 == '<' || kind0 == '2' - || code0 == TRUTH_ANDIF_EXPR || code0 == TRUTH_ORIF_EXPR - || code0 == TRUTH_AND_EXPR || code0 == TRUTH_OR_EXPR - || code0 == TRUTH_XOR_EXPR) - { - tree arg00 = TREE_OPERAND (arg0, 0); - tree arg01 = TREE_OPERAND (arg0, 1); - - if (TREE_CONSTANT (arg00) - || ((code0 == TRUTH_ANDIF_EXPR || code0 == TRUTH_ORIF_EXPR) - && ! has_cleanups (arg00))) - return fold (build2 (code0, type, arg00, - fold (build1 (CLEANUP_POINT_EXPR, - TREE_TYPE (arg01), arg01)))); - - if (TREE_CONSTANT (arg01)) - return fold (build2 (code0, type, - fold (build1 (CLEANUP_POINT_EXPR, - TREE_TYPE (arg00), arg00)), - arg01)); - } - - return t; - } - case CALL_EXPR: /* Check for a built-in function. */ if (TREE_CODE (TREE_OPERAND (t, 0)) == ADDR_EXPR diff --git a/gcc/tree.c b/gcc/tree.c index 9ef5a62a072..eb121991df1 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -1805,67 +1805,6 @@ type_contains_placeholder_p (tree type) gcc_unreachable (); } } - -/* Return 1 if EXP contains any expressions that produce cleanups for an - outer scope to deal with. Used by fold. */ - -int -has_cleanups (tree exp) -{ - int i, nops, cmp; - - if (! TREE_SIDE_EFFECTS (exp)) - return 0; - - switch (TREE_CODE (exp)) - { - case TARGET_EXPR: - case WITH_CLEANUP_EXPR: - return 1; - - case CLEANUP_POINT_EXPR: - return 0; - - case CALL_EXPR: - for (exp = TREE_OPERAND (exp, 1); exp; exp = TREE_CHAIN (exp)) - { - cmp = has_cleanups (TREE_VALUE (exp)); - if (cmp) - return cmp; - } - return 0; - - case DECL_EXPR: - return (DECL_INITIAL (DECL_EXPR_DECL (exp)) - && has_cleanups (DECL_INITIAL (DECL_EXPR_DECL (exp)))); - - default: - break; - } - - /* This general rule works for most tree codes. All exceptions should be - handled above. If this is a language-specific tree code, we can't - trust what might be in the operand, so say we don't know - the situation. */ - if ((int) TREE_CODE (exp) >= (int) LAST_AND_UNUSED_TREE_CODE) - return -1; - - nops = first_rtl_op (TREE_CODE (exp)); - for (i = 0; i < nops; i++) - if (TREE_OPERAND (exp, i) != 0) - { - int type = TREE_CODE_CLASS (TREE_CODE (TREE_OPERAND (exp, i))); - if (type == 'e' || type == '<' || type == '1' || type == '2' - || type == 'r' || type == 's') - { - cmp = has_cleanups (TREE_OPERAND (exp, i)); - if (cmp) - return cmp; - } - } - - return 0; -} /* Given a tree EXP, a FIELD_DECL F, and a replacement value R, return a tree with all occurrences of references to F in a diff --git a/gcc/tree.h b/gcc/tree.h index 0dd7eacc2a8..952402521d8 100644 --- a/gcc/tree.h +++ b/gcc/tree.h @@ -3240,11 +3240,6 @@ extern bool contains_placeholder_p (tree); extern bool type_contains_placeholder_p (tree); -/* Return 1 if EXP contains any expressions that produce cleanups for an - outer scope to deal with. Used by fold. */ - -extern int has_cleanups (tree); - /* Given a tree EXP, a FIELD_DECL F, and a replacement value R, return a tree with all occurrences of references to F in a PLACEHOLDER_EXPR replaced by R. Note that we assume here that EXP