From patchwork Sat Jul 9 01:20:46 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Gab Charette X-Patchwork-Id: 103953 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id 1E53E1007D4 for ; Sat, 9 Jul 2011 11:21:09 +1000 (EST) Received: (qmail 11324 invoked by alias); 9 Jul 2011 01:21:07 -0000 Received: (qmail 11315 invoked by uid 22791); 9 Jul 2011 01:21:06 -0000 X-SWARE-Spam-Status: No, hits=-1.5 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, SPF_HELO_PASS, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from smtp-out.google.com (HELO smtp-out.google.com) (74.125.121.67) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sat, 09 Jul 2011 01:20:52 +0000 Received: from kpbe15.cbf.corp.google.com (kpbe15.cbf.corp.google.com [172.25.105.79]) by smtp-out.google.com with ESMTP id p691Kn5W020508; Fri, 8 Jul 2011 18:20:50 -0700 Received: from gchare.mtv.corp.google.com (gchare.mtv.corp.google.com [172.18.111.122]) by kpbe15.cbf.corp.google.com with ESMTP id p691Kl6q001657; Fri, 8 Jul 2011 18:20:47 -0700 Received: by gchare.mtv.corp.google.com (Postfix, from userid 138564) id 0D90B1C36BA; Fri, 8 Jul 2011 18:20:46 -0700 (PDT) To: reply@codereview.appspotmail.com, crowl@google.com, dnovillo@google.com, gcc-patches@gcc.gnu.org Subject: [pph] Stream DECL_CHAIN only for VAR/FUNCTION_DECLs that are part of a RECORD_OR_UNION_TYPE (issue4672055) Message-Id: <20110709012047.0D90B1C36BA@gchare.mtv.corp.google.com> Date: Fri, 8 Jul 2011 18:20:46 -0700 (PDT) From: gchare@google.com (Gabriel Charette) X-System-Of-Record: true X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org 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 * 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. --- This patch is available for review at http://codereview.appspot.com/4672055 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;