From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16472 invoked by alias); 2 Sep 2013 14:44:05 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 16463 invoked by uid 89); 2 Sep 2013 14:44:04 -0000 Received: from nikam.ms.mff.cuni.cz (HELO nikam.ms.mff.cuni.cz) (195.113.20.16) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Mon, 02 Sep 2013 14:44:04 +0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.8 required=5.0 tests=AWL,BAYES_00,NO_RELAYS autolearn=ham version=3.3.2 X-HELO: nikam.ms.mff.cuni.cz Received: by nikam.ms.mff.cuni.cz (Postfix, from userid 16202) id A1B025430A8; Mon, 2 Sep 2013 16:44:00 +0200 (CEST) Date: Mon, 02 Sep 2013 14:44:00 -0000 From: Jan Hubicka To: Richard Biener Cc: Jan Hubicka , gcc-patches@gcc.gnu.org Subject: Re: Remove hash from remember_with_vars Message-ID: <20130902144400.GA339@kam.mff.cuni.cz> References: <20130831162022.GB22772@kam.mff.cuni.cz> <301dcb70-d7b5-4ad1-89fe-a20d5a78fba7@email.android.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <301dcb70-d7b5-4ad1-89fe-a20d5a78fba7@email.android.com> User-Agent: Mutt/1.5.20 (2009-06-14) X-SW-Source: 2013-09/txt/msg00074.txt.bz2 Hi, unfortunately this patch ICEs on the following testcase /* This used to fail on SPARC with an unaligned memory access. */ void foo(int n) { struct S { int i[n]; unsigned int b:1; int i2; } __attribute__ ((packed)) __attribute__ ((aligned (4))); struct S s; s.i2 = 0; } int main(void) { foo(4); return 0; } (in a tetsuite I must have missed during testing) because it check that field offset is always non-variable. I merely copied this sanity check from identical one in lto_fixup_prevailing_decls that however does not fire because it needs mentions_vars_p_field_decl to record the var first and that never happens. This patch fixes it by adding an fixup. Here the variable is local, but moving n to file scope is allowed. I have bootstrapped/regtested ppc64-linux, will commit it as obvious. I apologize for the breakage. I will prioritize fixing the fallout I caused this week. Honza Index: ChangeLog =================================================================== --- ChangeLog (revision 202173) +++ ChangeLog (working copy) @@ -1,5 +1,10 @@ 2013-08-31 Jan Hubicka + * lto.c (mentions_vars_p_field_decl, lto_fixup_prevailing_decls): + DECL_FIELD_OFFSET can contain an reference to variable. + +2013-08-31 Jan Hubicka + * lto.c (tree_with_vars): Turn into vector. (MAYBE_REMEMBER_WITH_VARS): Change to... (CHECK_VAR): ... this one. Index: lto.c =================================================================== --- lto.c (revision 202153) +++ lto.c (working copy) @@ -1389,7 +1389,7 @@ mentions_vars_p_field_decl (tree t) { if (mentions_vars_p_decl_common (t)) return true; - CHECK_NO_VAR (DECL_FIELD_OFFSET (t)); + CHECK_VAR (DECL_FIELD_OFFSET (t)); CHECK_NO_VAR (DECL_BIT_FIELD_TYPE (t)); CHECK_NO_VAR (DECL_QUALIFIER (t)); CHECK_NO_VAR (DECL_FIELD_BIT_OFFSET (t)); @@ -3207,7 +3207,7 @@ lto_fixup_prevailing_decls (tree t) LTO_SET_PREVAIL (DECL_FUNCTION_PERSONALITY (t)); if (CODE_CONTAINS_STRUCT (code, TS_FIELD_DECL)) { - LTO_NO_PREVAIL (DECL_FIELD_OFFSET (t)); + LTO_SET_PREVAIL (DECL_FIELD_OFFSET (t)); LTO_NO_PREVAIL (DECL_BIT_FIELD_TYPE (t)); LTO_NO_PREVAIL (DECL_QUALIFIER (t)); LTO_NO_PREVAIL (DECL_FIELD_BIT_OFFSET (t));