public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [pph] Stream DECL_CHAIN only for VAR/FUNCTION_DECLs that are part of a RECORD_OR_UNION_TYPE (issue4672055)
@ 2011-07-09 10:13 Gabriel Charette
  2011-07-12 19:50 ` Diego Novillo
  0 siblings, 1 reply; 5+ messages in thread
From: Gabriel Charette @ 2011-07-09 10:13 UTC (permalink / raw)
  To: reply, crowl, dnovillo, gcc-patches

The fix of streaming DECL_CHAIN in pph for VAR_DECL and FUNCTION_DECL was introduced to fix "member not found" errors for structs (and we don't have any tests with unions (we probably should...), but I believe they work the same). The fix was too general and was actually interfering with something I'm trying to do as part of the bug fix I'm on.

This thus restricts the streaming of the DECL_CHAIN for those two types only when needed.

Again, this doesn't fix any tests, but helps me in the current bug I'm working on.

Tested with bootstrap and pph regression testing.

Gab

2011-07-08  Gabriel Charette  <gchare@google.com>

	* pph-streamer-in.c (pph_in_function_decl): Stream in
	DECL_CHAIN of FUNCTION_DECL only if it's part of a RECORD_OR_UNION_TYPE
	(pph_read_tree): Stream in DECL_CHAIN of VAR_DECL only if it's part
	of a RECORD_OR_UNION_TYPE.
	* pph-streamer-out.c (pph_out_function_decl): Stream out
	DECL_CHAIN of FUNCTION_DECL only if it's part of a RECORD_OR_UNION_TYPE
	(pph_write_tree): Stream out DECL_CHAIN of VAR_DECL only if it's part
	of a RECORD_OR_UNION_TYPE.

diff --git a/gcc/cp/pph-streamer-in.c b/gcc/cp/pph-streamer-in.c
index 0bab93b..d78ee91 100644
--- a/gcc/cp/pph-streamer-in.c
+++ b/gcc/cp/pph-streamer-in.c
@@ -1396,7 +1396,8 @@ pph_in_function_decl (pph_stream *stream, tree fndecl)
   pph_in_lang_specific (stream, fndecl);
   DECL_SAVED_TREE (fndecl) = pph_in_tree (stream);
   DECL_STRUCT_FUNCTION (fndecl) = pph_in_struct_function (stream, fndecl);
-  DECL_CHAIN (fndecl) = pph_in_tree (stream);
+  if (DECL_CONTEXT (fndecl) && RECORD_OR_UNION_TYPE_P (DECL_CONTEXT (fndecl)))
+    DECL_CHAIN (fndecl) = pph_in_tree (stream);
   if (DECL_SAVED_TREE (fndecl))
     VEC_safe_push (tree, gc, stream->fns_to_expand, fndecl);
 }
@@ -1436,7 +1437,9 @@ pph_read_tree (struct lto_input_block *ib ATTRIBUTE_UNUSED,
       DECL_INITIAL (expr) = pph_in_tree (stream);
       pph_in_lang_specific (stream, expr);
       /* DECL_CHAIN is handled by generic code, except for VAR_DECLs.  */
-      if (TREE_CODE (expr) == VAR_DECL)
+      if (TREE_CODE (expr) == VAR_DECL
+	  && DECL_CONTEXT (expr)
+	  && RECORD_OR_UNION_TYPE_P (DECL_CONTEXT (expr)))
 	DECL_CHAIN (expr) = pph_in_tree (stream);
       break;
 
diff --git a/gcc/cp/pph-streamer-out.c b/gcc/cp/pph-streamer-out.c
index 089bb13..d1e757f 100644
--- a/gcc/cp/pph-streamer-out.c
+++ b/gcc/cp/pph-streamer-out.c
@@ -1257,7 +1257,8 @@ pph_out_function_decl (pph_stream *stream, tree fndecl, bool ref_p)
   pph_out_lang_specific (stream, fndecl, ref_p);
   pph_out_tree_or_ref_1 (stream, DECL_SAVED_TREE (fndecl), ref_p, 3);
   pph_out_struct_function (stream, DECL_STRUCT_FUNCTION (fndecl), ref_p);
-  pph_out_tree_or_ref_1 (stream, DECL_CHAIN (fndecl), ref_p, 3);
+  if (DECL_CONTEXT (fndecl) && RECORD_OR_UNION_TYPE_P (DECL_CONTEXT (fndecl)))
+    pph_out_tree_or_ref_1 (stream, DECL_CHAIN (fndecl), ref_p, 3);
 }
 
 /* Callback for writing ASTs to a stream.  This writes all the fields
@@ -1292,7 +1293,9 @@ pph_write_tree (struct output_block *ob, tree expr, bool ref_p)
       pph_out_tree_or_ref_1 (stream, DECL_INITIAL (expr), ref_p, 3);
       pph_out_lang_specific (stream, expr, ref_p);
       /* DECL_CHAIN is handled by generic code, except for VAR_DECLs.  */
-      if (TREE_CODE (expr) == VAR_DECL)
+      if (TREE_CODE (expr) == VAR_DECL
+	  && DECL_CONTEXT (expr)
+	  && RECORD_OR_UNION_TYPE_P (DECL_CONTEXT (expr)))
 	pph_out_tree_or_ref_1 (stream, DECL_CHAIN (expr), ref_p, 3);
       break;
 

--
This patch is available for review at http://codereview.appspot.com/4672055

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2011-07-13  0:17 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-07-09 10:13 [pph] Stream DECL_CHAIN only for VAR/FUNCTION_DECLs that are part of a RECORD_OR_UNION_TYPE (issue4672055) Gabriel Charette
2011-07-12 19:50 ` Diego Novillo
2011-07-12 20:56   ` Gabriel Charette
2011-07-12 23:26     ` Diego Novillo
2011-07-13  1:05       ` Gabriel Charette

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