This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Avoid ICE due to folding COMPONENT_REF in save_expr
- From: kenner at vlsi1 dot ultra dot nyu dot edu (Richard Kenner)
- To: gcc-patches at gcc dot gnu dot org
- Date: Tue, 29 Apr 03 18:43:37 EDT
- Subject: Avoid ICE due to folding COMPONENT_REF in save_expr
This fixes an ICE on a large Ada test case.
Tested on i686-pc-linux-gnu.
Fri Sep 27 15:58:53 2002 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
* tree.c (save_expr): Don't fold a COMPONENT_REF.
*** gcc/tree.c 16 Apr 2003 21:33:16 -0000 1.299
--- gcc/tree.c 24 Apr 2003 12:49:06 -0000
*************** save_expr (expr)
*** 1379,1384 ****
tree expr;
{
! tree t = fold (expr);
! tree inner = skip_simple_arithmetic (t);
/* If the tree evaluates to a constant, then we don't want to hide that
--- 1379,1390 ----
tree expr;
{
! 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
*************** save_expr (expr)
*** 1387,1390 ****
--- 1393,1397 ----
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))