OSDN Git Service

* tree.c (save_expr): Don't fold a COMPONENT_REF.
authorkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 29 Apr 2003 22:38:09 +0000 (22:38 +0000)
committerkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 29 Apr 2003 22:38:09 +0000 (22:38 +0000)
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@66264 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/tree.c

index 589009a..61ec00e 100644 (file)
@@ -1,3 +1,7 @@
+2003-04-29  Richard Kenner  <kenner@vlsi1.ultra.nyu.edu>
+
+       * tree.c (save_expr): Don't fold a COMPONENT_REF.
+
 2003-04-29  Olivier Hainque <hainque@act-europe.fr>
 
        * calls.c (expand_call): When modes of target and valreg match, force
index ce5e219..7deaa65 100644 (file)
@@ -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