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]

Re: Problem with nested functions, aliasing, ssa rewriting, etc


On Wed, Mar 10, 2004 at 11:44:18AM -0700, law@redhat.com wrote:
>   CHAIN.1_2->p = &CHAIN.1->buffer;

The problem here is that this used to be "&buffer", which
had the TREE_INVARANT bit set.  Failing to clear that meant
that we incorrectly treated the entire rhs as min_invariant.

Fixed thus.  I'll put this through the testsuite momentarily.

Also noticed a problem in note_addressable where we'd consider

	&x->y

to address X, when this is in fact a normal use.  Any use of
get_base_decl should be viewed with suspicion...



r~


	* tree-nested.c (convert_nonlocal_reference): Clear TREE_INVARIANT
	on modified ADDR_EXPRs.
	* tree-ssa-operands.c (note_addressable): Use get_base_address.

Index: tree-nested.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-nested.c,v
retrieving revision 1.1.2.2
diff -c -p -d -u -r1.1.2.2 tree-nested.c
--- tree-nested.c	16 Feb 2004 15:29:55 -0000	1.1.2.2
+++ tree-nested.c	10 Mar 2004 21:47:48 -0000
@@ -763,11 +763,18 @@ convert_nonlocal_reference (tree *tp, in
 	walk_tree (&TREE_OPERAND (t, 0), convert_nonlocal_reference, wi, NULL);
 	wi->val_only = save_val_only;
 
-	/* If the callback converted the address argument in a context
-	   where we only accept variables (and min_invariant, presumably),
-	   then compute the address into a temporary.  */
-	if (save_val_only && save_sub != TREE_OPERAND (t, 0))
-	  *tp = gimplify_val (wi->info, t, &wi->tsi);
+	if (save_sub != TREE_OPERAND (t, 0))
+	  {
+	    /* If we changed anything, then TREE_INVARIANT is be wrong,
+	       since we're no longer directly referencing a decl.  */
+	    TREE_INVARIANT (t) = 0;
+
+	    /* If the callback converted the address argument in a context
+	       where we only accept variables (and min_invariant, presumably),
+	       then compute the address into a temporary.  */
+	    if (save_val_only)
+	      *tp = gimplify_val (wi->info, t, &wi->tsi);
+	  }
       }
       break;
 
Index: tree-ssa-operands.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/Attic/tree-ssa-operands.c,v
retrieving revision 1.1.2.14
diff -c -p -d -u -r1.1.2.14 tree-ssa-operands.c
--- tree-ssa-operands.c	3 Mar 2004 00:59:48 -0000	1.1.2.14
+++ tree-ssa-operands.c	10 Mar 2004 21:47:48 -0000
@@ -1268,7 +1268,7 @@ add_stmt_operand (tree *var_p, tree stmt
 static void
 note_addressable (tree var, stmt_ann_t s_ann)
 {
-  var = get_base_decl (var);
+  var = get_base_address (var);
   if (var && SSA_VAR_P (var))
     {
       if (s_ann->addresses_taken == NULL)


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