public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] Fix canonicalize_constructor_val
@ 2011-11-08 12:03 Richard Guenther
  0 siblings, 0 replies; only message in thread
From: Richard Guenther @ 2011-11-08 12:03 UTC (permalink / raw)
  To: gcc-patches


This fixes an oversight in canonicalize_constructor_val which
can result in trying to add a referenced var to a function that
doesn't have them computed when folding a statement before
referenced_vars pass has been run.

Committed.

Richard.

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.

Index: gcc/gimple-fold.c
===================================================================
--- gcc/gimple-fold.c	(revision 181154)
+++ gcc/gimple-fold.c	(working copy)
@@ -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)))

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2011-11-08 11:22 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-11-08 12:03 [PATCH] Fix canonicalize_constructor_val Richard Guenther

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).