From: Richard Guenther <rguenther@suse.de>
To: gcc-patches@gcc.gnu.org
Subject: [PATCH] Fix canonicalize_constructor_val
Date: Tue, 08 Nov 2011 12:03:00 -0000 [thread overview]
Message-ID: <alpine.LNX.2.00.1111081221370.4527@zhemvz.fhfr.qr> (raw)
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)))
reply other threads:[~2011-11-08 11:22 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=alpine.LNX.2.00.1111081221370.4527@zhemvz.fhfr.qr \
--to=rguenther@suse.de \
--cc=gcc-patches@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).