aboutsummaryrefslogtreecommitdiff
path: root/gcc/tree.c
diff options
context:
space:
mode:
authorRichard Kenner <kenner@vlsi1.ultra.nyu.edu>2003-04-29 22:38:09 +0000
committerRichard Kenner <kenner@gcc.gnu.org>2003-04-29 18:38:09 -0400
commit84d8756de1f15d0d04a959133930bfc95e3c5acb (patch)
tree53c57435c363b6dbb8c6da7f848536313fdc98a5 /gcc/tree.c
parent1f6f0cb610621cec5a80b54ba850fee18d4282ad (diff)
downloadgcc-84d8756de1f15d0d04a959133930bfc95e3c5acb.zip
gcc-84d8756de1f15d0d04a959133930bfc95e3c5acb.tar.gz
gcc-84d8756de1f15d0d04a959133930bfc95e3c5acb.tar.bz2
* tree.c (save_expr): Don't fold a COMPONENT_REF.
From-SVN: r66264
Diffstat (limited to 'gcc/tree.c')
-rw-r--r--gcc/tree.c11
1 files changed, 9 insertions, 2 deletions
diff --git a/gcc/tree.c b/gcc/tree.c
index ce5e219..7deaa65 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -1378,14 +1378,21 @@ tree
save_expr (expr)
tree expr;
{
- tree t = fold (expr);
- tree inner = skip_simple_arithmetic (t);
+ tree t = expr;
+ tree inner;
+
+ /* Don't fold a COMPONENT_EXPR: if the operand was a CONSTRUCTOR (the
+ only time it will fold), it can cause problems with PLACEHOLDER_EXPRs
+ in Ada. Moreover, it isn't at all clear why we fold here at all. */
+ if (TREE_CODE (t) != COMPONENT_REF)
+ t = fold (t);
/* If the tree evaluates to a constant, then we don't want to hide that
fact (i.e. this allows further folding, and direct checks for constants).
However, a read-only object that has side effects cannot be bypassed.
Since it is no problem to reevaluate literals, we just return the
literal node. */
+ inner = skip_simple_arithmetic (t);
if (TREE_CONSTANT (inner)
|| (TREE_READONLY (inner) && ! TREE_SIDE_EFFECTS (inner))
|| TREE_CODE (inner) == SAVE_EXPR