Mark Mitchell wrote on 03/30/07 12:22:

> So, I think the right fix is (a) the change above, (b) remove the
> TREE_ADDRESSABLE setting from mark_vtable_entries (possibly replacing it
> with an assert.)

After removing the papering over TREE_ADDRESSABLE we were doing in the
aliaser, I found that other users of ADDR_EXPR are not consistently
setting the addressability bit.

This led me to this patch, which I'm now testing.  This removes the
workaround we had in the aliaser and consistently marks every DECL
that's put in an ADDR_EXPR as addressable.

One thing that I'm wondering about this patch is why hasn't this been
done before?  We seem to purposely separate TREE_ADDRESSABLE from
ADDR_EXPR.  Perhaps to prevent pessimistic assumptions?  The current
aliasing code removes addressability when it can prove otherwise.

This patch bootstraps all default languages.  I'll test Ada later on,
but I need input from all the FE folks.


Thanks.


2007-03-30  Diego Novillo  <[EMAIL PROTECTED]>

	* tree.c (build1_stat): When building ADDR_EXPR of a DECL,
	mark it addressable.
	* tree-ssa-alias.c (add_may_alias): Assert that ALIAS may be
	aliased.
	* c-typeck.c (c_mark_addressable): Handle LABEL_DECL.

Index: tree.c
===================================================================
--- tree.c	(revision 123332)
+++ tree.c	(working copy)
@@ -2922,7 +2922,11 @@ build1_stat (enum tree_code code, tree t
 
     case ADDR_EXPR:
       if (node)
-	recompute_tree_invariant_for_addr_expr (t);
+	{
+	  recompute_tree_invariant_for_addr_expr (t);
+	  if (DECL_P (node))
+	    lang_hooks.mark_addressable (node);
+	}
       break;
 
     default:
Index: tree-ssa-alias.c
===================================================================
--- tree-ssa-alias.c	(revision 123332)
+++ tree-ssa-alias.c	(working copy)
@@ -2045,11 +2045,7 @@ add_may_alias (tree var, tree alias)
   gcc_assert (var != alias);
 
   /* ALIAS must be addressable if it's being added to an alias set.  */
-#if 1
-  TREE_ADDRESSABLE (alias) = 1;
-#else
   gcc_assert (may_be_aliased (alias));
-#endif
 
   if (v_ann->may_aliases == NULL)
     v_ann->may_aliases = VEC_alloc (tree, gc, 2);
Index: c-typeck.c
===================================================================
--- c-typeck.c	(revision 123332)
+++ c-typeck.c	(working copy)
@@ -3247,6 +3247,7 @@ c_mark_addressable (tree exp)
 
 	/* drops in */
       case FUNCTION_DECL:
+      case LABEL_DECL:
 	TREE_ADDRESSABLE (x) = 1;
 	/* drops out */
       default:

Reply via email to