This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: gimplify_parameters
- From: Richard Henderson <rth at redhat dot com>
- To: Richard Kenner <kenner at vlsi1 dot ultra dot nyu dot edu>
- Cc: gcc at gcc dot gnu dot org
- Date: Mon, 20 Dec 2004 19:14:01 -0800
- Subject: Re: gimplify_parameters
- References: <10412210244.AA26707@vlsi1.ultra.nyu.edu>
On Mon, Dec 20, 2004 at 09:44:16PM -0500, Richard Kenner wrote:
> The point is that Temp_File_Record is used as the type of a parameter in
> *two* functions, so gimplify_parameters is being called with that type
> *twice*. The first time, nothing has gone wrong but it's updated DECL_OFFSET
> to be a new variable in the context of that first function.
Oh, right. Now I get it.
I thought that gimplify_type_sizes didn't actually modify the type node
itself, that all the modification was reserved for the SAVE_EXPR within.
That's clearly not the case now, but I think that is the Correct solution
to the bug.
The following fixes the ICE on s-fileio.adb. I guess I'll run it through
and see what happens. And then try and fix the C problems you uncovered.
r~
* gimplify.c (eval_save_expr): New.
(gimplify_one_sizepos): Use it.
Index: gimplify.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/gimplify.c,v
retrieving revision 2.94
diff -c -p -d -r2.94 gimplify.c
*** gimplify.c 20 Dec 2004 11:26:27 -0000 2.94
--- gimplify.c 21 Dec 2004 03:12:08 -0000
*************** gimplify_type_sizes (tree type, tree *li
*** 4217,4223 ****
gimplify_one_sizepos (&TYPE_SIZE_UNIT (type), list_p);
}
! /* Subroutine of the above to gimplify one size or position, *EXPR_P.
We add any required statements to STMT_P. */
void
--- 4217,4241 ----
gimplify_one_sizepos (&TYPE_SIZE_UNIT (type), list_p);
}
! /* A subroutine of gimplify_one_sizepos, called via walk_tree. Evaluate
! the expression if it's a SAVE_EXPR and add it to the statement list
! in DATA. */
!
! static tree
! eval_save_expr (tree *tp, int *walk_subtrees, void *data)
! {
! if (TREE_CODE (*tp) == SAVE_EXPR)
! {
! *walk_subtrees = 0;
! gimplify_and_add (*tp, (tree *) data);
! }
! else if (TYPE_P (*tp) || DECL_P (*tp))
! *walk_subtrees = 0;
! return NULL;
! }
!
! /* A subroutine of gimplify_type_sizes to make sure that *EXPR_P,
! a size or position, has had all of its SAVE_EXPRs evaluated.
We add any required statements to STMT_P. */
void
*************** gimplify_one_sizepos (tree *expr_p, tree
*** 4233,4239 ****
|| CONTAINS_PLACEHOLDER_P (*expr_p))
return;
! gimplify_expr (expr_p, stmt_p, NULL, is_gimple_val, fb_rvalue);
}
#ifdef ENABLE_CHECKING
--- 4251,4257 ----
|| CONTAINS_PLACEHOLDER_P (*expr_p))
return;
! walk_tree (expr_p, eval_save_expr, stmt_p, NULL);
}
#ifdef ENABLE_CHECKING