aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Henderson <rth@redhat.com>2004-09-12 14:36:50 -0700
committerRichard Henderson <rth@gcc.gnu.org>2004-09-12 14:36:50 -0700
commit373c0e7f04097a50d480846786894883adbf5e45 (patch)
tree051c6e5b7ae1bdd153f37194a1ba91a1342fe790
parent7fac672272cce6ed7e6e8ca9a54116d40f303dd7 (diff)
downloadgcc-373c0e7f04097a50d480846786894883adbf5e45.zip
gcc-373c0e7f04097a50d480846786894883adbf5e45.tar.gz
gcc-373c0e7f04097a50d480846786894883adbf5e45.tar.bz2
re PR c++/16254 (ICE in lower_stmt, at gimple-low.c:205)
PR c++/16254 * fold-const.c (fold) <case CLEANUP_POINT_EXPR>: 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
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/cp/ChangeLog6
-rw-r--r--gcc/cp/semantics.c2
-rw-r--r--gcc/cp/typeck.c2
-rw-r--r--gcc/fold-const.c43
-rw-r--r--gcc/tree.c61
-rw-r--r--gcc/tree.h5
7 files changed, 14 insertions, 111 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 59d386e..95f1545 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2004-09-12 Richard Henderson <rth@redhat.com>
+
+ PR c++/16254
+ * fold-const.c (fold) <case CLEANUP_POINT_EXPR>: Remove.
+ * tree.c, tree.h (has_cleanups): Remove.
+
2004-09-12 Zdenek Dvorak <rakdver@atrey.karlin.mff.cuni.cz>
* tree-ssa-loop-manip.c (split_loop_exit_edge): Handle non-ssaname
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index c8ba24d..37f0811 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,9 @@
+2004-09-12 Richard Henderson <rth@redhat.com>
+
+ PR c++/16254
+ * semantics.c (maybe_cleanup_point_expr): Don't call fold.
+ * typeck.c (condition_conversion): Likewise.
+
2004-09-11 Richard Henderson <rth@redhat.com>
PR c++/17404
diff --git a/gcc/cp/semantics.c b/gcc/cp/semantics.c
index bdf1439..1ea97a0 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 77fd20a..2169bad 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 31bf7fd..972f276d 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 9ef5a62..eb12199 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 0dd7eac..9524025 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