gimple-fold.c (canonicalize_constructor_val): Make sure we have referenced vars setup before adding to them.

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

	* gimple-fold.c (canonicalize_constructor_val): Make sure
	we have referenced vars setup before adding to them.

From-SVN: r181155
This commit is contained in:
Richard Guenther 2011-11-08 11:23:11 +00:00 committed by Richard Biener
parent 0a35513e4e
commit 4835617e59
2 changed files with 7 additions and 1 deletions

View File

@ -1,3 +1,8 @@
2011-11-08 Richard Guenther <rguenther@suse.de>
* gimple-fold.c (canonicalize_constructor_val): Make sure
we have referenced vars setup before adding to them.
2011-11-07 Richard Henderson <rth@redhat.com>
Aldy Hernandez <aldyh@redhat.com>
Andrew MacLeod <amacleod@redhat.com>

View File

@ -137,7 +137,8 @@ canonicalize_constructor_val (tree cval)
|| TREE_CODE (base) == FUNCTION_DECL)
&& !can_refer_decl_in_current_unit_p (base))
return NULL_TREE;
if (cfun && base && TREE_CODE (base) == VAR_DECL)
if (cfun && gimple_referenced_vars (cfun)
&& base && TREE_CODE (base) == VAR_DECL)
add_referenced_var (base);
/* Fixup types in global initializers. */
if (TREE_TYPE (TREE_TYPE (cval)) != TREE_TYPE (TREE_OPERAND (cval, 0)))