From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3238 invoked by alias); 19 Oct 2011 08:26:10 -0000 Received: (qmail 3219 invoked by uid 22791); 19 Oct 2011 08:26:09 -0000 X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_DNSWL_LOW X-Spam-Check-By: sourceware.org Received: from mail-yx0-f175.google.com (HELO mail-yx0-f175.google.com) (209.85.213.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 19 Oct 2011 08:25:54 +0000 Received: by yxo30 with SMTP id 30so1615322yxo.20 for ; Wed, 19 Oct 2011 01:25:54 -0700 (PDT) MIME-Version: 1.0 Received: by 10.42.197.73 with SMTP id ej9mr11186134icb.2.1319012754033; Wed, 19 Oct 2011 01:25:54 -0700 (PDT) Received: by 10.182.28.138 with HTTP; Wed, 19 Oct 2011 01:25:53 -0700 (PDT) In-Reply-To: <20111018122129.GP2210@tyan-ft48-01.lab.bos.redhat.com> References: <20111018122129.GP2210@tyan-ft48-01.lab.bos.redhat.com> Date: Wed, 19 Oct 2011 08:43:00 -0000 Message-ID: Subject: Re: [4.6] Fix type of SRAed enum accesses From: Richard Guenther To: Jakub Jelinek Cc: gcc-patches@gcc.gnu.org, Martin Jambor , richard.sandiford@linaro.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-10/txt/msg01704.txt.bz2 On Tue, Oct 18, 2011 at 2:21 PM, Jakub Jelinek wrote: > On Tue, Sep 27, 2011 at 03:26:03PM +0100, Richard Sandiford wrote: >> This patch fixes a miscompilation of stage1 c-parser.o in an ARM bootstr= ap. >> When an access to an enum field was SRAed, a component ref used the type >> of the integer temporary variable instead of the type of the enum. >> It therefore didn't alias other accesses to the same structure, >> and was scheduled after a copy-load. >> >> Tested on x86_64-linux-gnu, and by verifying that c-parser.o is correctly >> compiled for ARM after the patch. =A0Martin says he's going to test on i= a64 >> too (thanks) -- I'll add 50326 to the changelog if that goes OK. >> >> OK to install if there are no regressions on ia64? > > As mentioned in bugzilla, the patch that caused this regression has been > committed to 4.6 branch as well. > > Here is a backport of that patch to 4.6 branch, bootstrapped/regtested on > x86_64-linux and i686-linux and Matthias AFAIK bootstrapped it on ia64-li= nux > (where it previously failed to bootstrap because of this), regtest pendin= g. > > Ok for 4.6? Ok. Richard. > 2011-10-18 =A0Jakub Jelinek =A0 > > =A0 =A0 =A0 =A0PR target/50350 > =A0 =A0 =A0 =A0Backport from mainline > =A0 =A0 =A0 =A02011-09-27 =A0Richard Sandiford =A0 > > =A0 =A0 =A0 =A0PR middle-end/50386 > =A0 =A0 =A0 =A0PR middle-end/50326 > =A0 =A0 =A0 =A0* tree-sra.c (build_ref_for_model): Use the type of the fi= eld as > =A0 =A0 =A0 =A0the type of the COMPONENT_REF. > > --- gcc/tree-sra.c.jj =A0 2011-09-30 17:19:10.000000000 +0200 > +++ gcc/tree-sra.c =A0 =A0 =A02011-10-18 08:01:28.682647833 +0200 > @@ -1448,12 +1448,12 @@ build_ref_for_model (location_t loc, tre > =A0{ > =A0 if (TREE_CODE (model->expr) =3D=3D COMPONENT_REF) > =A0 =A0 { > - =A0 =A0 =A0tree t, exp_type; > - =A0 =A0 =A0offset -=3D int_bit_position (TREE_OPERAND (model->expr, 1)); > + =A0 =A0 =A0tree t, exp_type, fld =3D TREE_OPERAND (model->expr, 1); > + =A0 =A0 =A0offset -=3D int_bit_position (fld); > =A0 =A0 =A0 exp_type =3D TREE_TYPE (TREE_OPERAND (model->expr, 0)); > =A0 =A0 =A0 t =3D build_ref_for_offset (loc, base, offset, exp_type, gsi,= insert_after); > - =A0 =A0 =A0return fold_build3_loc (loc, COMPONENT_REF, model->type, t, > - =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 TREE_OPERAND (m= odel->expr, 1), NULL_TREE); > + =A0 =A0 =A0return fold_build3_loc (loc, COMPONENT_REF, TREE_TYPE (fld),= t, fld, > + =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0 NULL_TREE); > =A0 =A0 } > =A0 else > =A0 =A0 return build_ref_for_offset (loc, base, offset, model->type, > > =A0 =A0 =A0 =A0Jakub >