From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16512 invoked by alias); 27 Sep 2011 15:18:08 -0000 Received: (qmail 16502 invoked by uid 22791); 27 Sep 2011 15:18:07 -0000 X-SWARE-Spam-Status: No, hits=-3.3 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from cantor2.suse.de (HELO mx2.suse.de) (195.135.220.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Tue, 27 Sep 2011 15:17:51 +0000 Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.221.2]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mx2.suse.de (Postfix) with ESMTP id E50F98FB3C; Tue, 27 Sep 2011 17:17:49 +0200 (CEST) Date: Tue, 27 Sep 2011 16:44:00 -0000 From: Martin Jambor To: gcc-patches@gcc.gnu.org, richard.sandiford@linaro.org Subject: Re: Fix type of SRAed enum accesses Message-ID: <20110927151749.GB29335@virgil.arch.suse.de> Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@linaro.org References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) 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/msg01737.txt.bz2 Hi, 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 bootstrap. > 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. Martin says he's going to test on ia64 > too (thanks) -- I'll add 50326 to the changelog if that goes OK. > > OK to install if there are no regressions on ia64? > C and C++ bootstrap passed fine on ia64 with this patch so it is indeed the correct fix for PR 50326. Thanks! Martin > Richard > > > gcc/ > PR middle-end/50386 > * tree-sra.c (build_ref_for_model): Use the type of the field as > the type of the COMPONENT_REF. > > Index: gcc/tree-sra.c > =================================================================== > --- gcc/tree-sra.c 2011-09-12 09:09:34.000000000 +0100 > +++ gcc/tree-sra.c 2011-09-27 14:09:45.379960167 +0100 > @@ -1504,7 +1504,7 @@ build_ref_for_model (location_t loc, tre > offset -= TREE_INT_CST_LOW (DECL_FIELD_BIT_OFFSET (fld)); > exp_type = TREE_TYPE (TREE_OPERAND (model->expr, 0)); > t = build_ref_for_offset (loc, base, offset, exp_type, gsi, insert_after); > - return fold_build3_loc (loc, COMPONENT_REF, model->type, t, fld, > + return fold_build3_loc (loc, COMPONENT_REF, TREE_TYPE (fld), t, fld, > TREE_OPERAND (model->expr, 2)); > } > else