[PATCH] Fixup canonicalize_constructor_val some more

Richard Guenther rguenther@suse.de
Wed Nov 9 08:48:00 GMT 2011


Make sure to mark decl addresses coming from constructors
as addressable (otherwise early folding fails for all java testcases).

Bootstrapped and tested on x86_64-unknown-linux-gnu, applied.

Richard.

2011-11-09  Richard Guenther  <rguenther@suse.de>

	* gimple-fold.c (canonicalize_constructor_val): Mark
	address-taken variables addressable.

Index: gcc/gimple-fold.c
===================================================================
--- gcc/gimple-fold.c	(revision 181173)
+++ gcc/gimple-fold.c	(working copy)
@@ -137,9 +137,12 @@ canonicalize_constructor_val (tree cval)
 	      || TREE_CODE (base) == FUNCTION_DECL)
 	  && !can_refer_decl_in_current_unit_p (base))
 	return NULL_TREE;
-      if (cfun && gimple_referenced_vars (cfun)
-	  && base && TREE_CODE (base) == VAR_DECL)
-	add_referenced_var (base);
+      if (base && TREE_CODE (base) == VAR_DECL)
+	{
+	  TREE_ADDRESSABLE (base) = 1;
+	  if (cfun && gimple_referenced_vars (cfun))
+	    add_referenced_var (base);
+	}
       /* Fixup types in global initializers.  */
       if (TREE_TYPE (TREE_TYPE (cval)) != TREE_TYPE (TREE_OPERAND (cval, 0)))
 	cval = build_fold_addr_expr (TREE_OPERAND (cval, 0));



More information about the Gcc-patches mailing list