This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Fix intrinsic_pack.f90, tree-nested not marking some decls as addressable


The problem here is that we have "&a[4];" which we change to
&FRAME.117.a[4]; in tree-nested but we don't mark the frame as
addressable so we get an ICE.  This fixes the problem by instead
of checking if the immediate part of the ADDR_EXPR we should check
that we changed any part of the address expression.

OK? Bootstrapped and tested on powerpc-darwin.

The testcase is already in the testsuite and fails currently.

Thanks,
Andrew Pinski

ChangeLog:
	* tree-nested.c (walk_stmt_info): Add changed field.
	(convert_nonlocal_reference): Set changed to when we
	change a decl to unnested decl.
	<case ADDR_EXPR>: Instead of checking if the immediate part
	of the ADDR_EXPR changed, check the field changed.
	Use recompute_tree_invarant_for_addr_expr instead of unsetting
	TREE_INVARIANT.
	(convert_local_reference):  Set changed to when we
	change a decl to unnested decl.
	<case ADDR_EXPR>: Instead of checking if the immediate part
	of the ADDR_EXPR changed, check the field changed.
	Also call recompute_tree_invarant_for_addr_expr on the ADDR_EXPR.


Index: tree-nested.c =================================================================== RCS file: /cvs/gcc/gcc/gcc/tree-nested.c,v retrieving revision 2.19 diff -u -p -r2.19 tree-nested.c --- tree-nested.c 20 Sep 2004 20:38:17 -0000 2.19 +++ tree-nested.c 5 Oct 2004 18:08:51 -0000 @@ -518,6 +518,7 @@ struct walk_stmt_info tree_stmt_iterator tsi; struct nesting_info *info; bool val_only; + bool changed; };

/* A subroutine of walk_function. Iterate over all sub-statements of *TP. */
@@ -732,6 +747,7 @@ convert_nonlocal_reference (tree *tp, in
tree target_context = decl_function_context (t);
struct nesting_info *i;
tree x;
+ wi->changed = true;


 	  for (i = info->outer; i->context != target_context; i = i->outer)
 	    continue;
@@ -770,17 +786,17 @@ convert_nonlocal_reference (tree *tp, in
     case ADDR_EXPR:
       {
 	bool save_val_only = wi->val_only;
-	tree save_sub = TREE_OPERAND (t, 0);

+ wi->changed = false;
wi->val_only = false;
walk_tree (&TREE_OPERAND (t, 0), convert_nonlocal_reference, wi, NULL);
wi->val_only = true;


-	if (save_sub != TREE_OPERAND (t, 0))
+	if (wi->changed)
 	  {
 	    /* If we changed anything, then TREE_INVARIANT is be wrong,
 	       since we're no longer directly referencing a decl.  */
-	    TREE_INVARIANT (t) = 0;
+	    recompute_tree_invarant_for_addr_expr (t);

 	    /* If the callback converted the address argument in a context
 	       where we only accept variables (and min_invariant, presumably),
@@ -874,6 +890,7 @@ convert_local_reference (tree *tp, int *
 	  field = lookup_field_for_decl (info, t, NO_INSERT);
 	  if (!field)
 	    break;
+	  wi->changed = true;

 	  x = get_frame_field (info, info->context, field, &wi->tsi);
 	  if (wi->val_only)
@@ -885,17 +902,19 @@ convert_local_reference (tree *tp, int *
     case ADDR_EXPR:
       {
 	bool save_val_only = wi->val_only;
-	tree save_sub = TREE_OPERAND (t, 0);

+	wi->changed = false;
 	wi->val_only = false;
 	walk_tree (&TREE_OPERAND (t, 0), convert_local_reference, wi, NULL);
 	wi->val_only = save_val_only;

 	/* If we converted anything ... */
-	if (TREE_OPERAND (t, 0) != save_sub)
+	if (wi->changed)
 	  {
 	    /* Then the frame decl is now addressable.  */
 	    TREE_ADDRESSABLE (info->frame_decl) = 1;
+	
+	    recompute_tree_invarant_for_addr_expr (t);

 	    /* If we are in a context where we only accept values, then
 	       compute the address into a temporary.  */


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]