From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 30182 invoked by alias); 27 Sep 2011 14:43:56 -0000 Received: (qmail 30168 invoked by uid 22791); 27 Sep 2011 14:43:55 -0000 X-SWARE-Spam-Status: No, hits=-1.6 required=5.0 tests=AWL,BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FROM,RCVD_IN_BL_SPAMCOP_NET,RCVD_IN_DNSWL_LOW X-Spam-Check-By: sourceware.org Received: from mail-gy0-f175.google.com (HELO mail-gy0-f175.google.com) (209.85.160.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 27 Sep 2011 14:43:38 +0000 Received: by gyg8 with SMTP id 8so5903155gyg.20 for ; Tue, 27 Sep 2011 07:43:37 -0700 (PDT) MIME-Version: 1.0 Received: by 10.151.13.16 with SMTP id q16mr7772984ybi.181.1317134617363; Tue, 27 Sep 2011 07:43:37 -0700 (PDT) Received: by 10.150.177.4 with HTTP; Tue, 27 Sep 2011 07:43:37 -0700 (PDT) In-Reply-To: References: Date: Tue, 27 Sep 2011 16:17:00 -0000 Message-ID: Subject: Re: Fix type of SRAed enum accesses From: Richard Guenther To: 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-09/txt/msg01735.txt.bz2 On Tue, Sep 27, 2011 at 4:26 PM, Richard Sandiford wrote: > This patch fixes a miscompilation of stage1 c-parser.o in an ARM bootstra= p. > 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 ia= 64 > too (thanks) -- I'll add 50326 to the changelog if that goes OK. > > OK to install if there are no regressions on ia64? Ok. Thanks, Richard. > Richard > > > gcc/ > =A0 =A0 =A0 =A0PR middle-end/50386 > =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. > > Index: gcc/tree-sra.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > --- gcc/tree-sra.c =A0 =A0 =A02011-09-12 09:09:34.000000000 +0100 > +++ gcc/tree-sra.c =A0 =A0 =A02011-09-27 14:09:45.379960167 +0100 > @@ -1504,7 +1504,7 @@ build_ref_for_model (location_t loc, tre > =A0 =A0 =A0 offset -=3D TREE_INT_CST_LOW (DECL_FIELD_BIT_OFFSET (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, = fld, > + =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 =A0TREE_OPERAND (= model->expr, 2)); > =A0 =A0 } > =A0 else >