From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4501 invoked by alias); 16 Jun 2011 07:57:10 -0000 Received: (qmail 4493 invoked by uid 22791); 16 Jun 2011 07:57:10 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW,RFC_ABUSE_POST X-Spam-Check-By: sourceware.org Received: from mail-ww0-f51.google.com (HELO mail-ww0-f51.google.com) (74.125.82.51) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Thu, 16 Jun 2011 07:56:54 +0000 Received: by wwf26 with SMTP id 26so1120807wwf.8 for ; Thu, 16 Jun 2011 00:56:53 -0700 (PDT) MIME-Version: 1.0 Received: by 10.227.163.76 with SMTP id z12mr546557wbx.75.1308211012790; Thu, 16 Jun 2011 00:56:52 -0700 (PDT) Received: by 10.227.28.69 with HTTP; Thu, 16 Jun 2011 00:56:52 -0700 (PDT) In-Reply-To: References: <20110611160548.GA20036@intel.com> Date: Thu, 16 Jun 2011 08:02:00 -0000 Message-ID: Subject: Re: PATCH [5/n]: Prepare x32: PR middle-end/48016: Inconsistency in non-local goto save area From: Richard Guenther To: "H.J. Lu" Cc: Michael Matz , gcc-patches@gcc.gnu.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-IsSubscribed: yes 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 X-SW-Source: 2011-06/txt/msg01218.txt.bz2 On Wed, Jun 15, 2011 at 9:55 PM, H.J. Lu wrote: > On Wed, Jun 15, 2011 at 8:16 AM, Michael Matz wrote: >> Hi, >> >> On Wed, 15 Jun 2011, H.J. Lu wrote: >> >>> >> + =A0/* FIXME: update_nonlocal_goto_save_area may pass SA in the wro= ng mode. =A0*/ >>> >> + =A0if (GET_MODE (sa) !=3D mode) >>> >> + =A0 =A0{ >>> >> + =A0 =A0 =A0gcc_assert (ptr_mode !=3D Pmode >>> >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 && GET_MODE (sa) =3D=3D ptr_mode >>> >> + =A0 =A0 =A0 =A0 =A0 =A0 =A0 && mode =3D=3D Pmode); >>> >> + =A0 =A0 =A0sa =3D adjust_address (sa, mode, 0); >>> >> + =A0 =A0} >>> > >>> > That may be appropriate for a branch, but trunk shouldn't contain FIX= MEs >>> > that explain how something should be fixed, instead that something sh= ould >>> > be carried out. =A0I.e. just fix update_nonlocal_goto_save_area. >>> > >>> >>> I don't know update_nonlocal_goto_save_area enough to fix it >>> without breaking other targets. =A0This patch is the lest invasive. >>> Any suggestions how to properly fix it is appreciated. >> >> Well, the most obvious variant would be to move the above code right >> before the call of emit_stack_save in update_nonlocal_goto_save_area >> (using r_save and STACK_SAVEAREA_MODE (SAVE_NONLOCAL)). =A0All other cal= lers >> of emit_stack_save already make sure to pass an object of correct mode, = so >> this one should too. >> >> But I think it's better to just produce a correct array_ref from the >> start. =A0get_nl_goto_field creates an array_type for the >> nonlocal_goto_save_area of correct type (ptr_type_node or >> lang_hooks.types.type_for_mode (Pmode, 1)), and we should use that. >> >> So something like this in update_nonlocal_goto_save_area: >> =A0t_save =3D build4 (ARRAY_REF, >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 TREE_TYPE (TREE_TYPE (cfun->nonlocal= _goto_save_area)), >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 cfun->nonlocal_goto_save_area, >> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 integer_one_node, NULL_TREE, NULL_TR= EE); >> >> instead of the current building of t_save. =A0Then r_save also should get >> the correct mode automatically. >> > > Here is the updated patch. =A0OK for trunk? The explow.c change is ok. For the function.c change I wonder why convert_memory_address doesn't do the right thing - from it's documentation it definitely should, so it should be fixed instead of being replaced by adjust_address with a zero offset. Richard. > Thanks. > > -- > H.J. > --- > 2011-06-15 =A0H.J. Lu =A0 > > =A0 =A0 =A0 =A0PR middle-end/48016 > =A0 =A0 =A0 =A0* explow.c (update_nonlocal_goto_save_area): Use proper mo= de > =A0 =A0 =A0 =A0for stack save area. > > =A0 =A0 =A0 =A0* function.c (expand_function_start): Properly store frame > =A0 =A0 =A0 =A0pointer for non-local goto. >