diff mbox

Fixup canonicalize_constructor_val some more

Message ID alpine.LNX.2.00.1111090930000.4527@zhemvz.fhfr.qr
State New
Headers show

Commit Message

Richard Biener Nov. 9, 2011, 8:31 a.m. UTC
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.
diff mbox

Patch

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));