public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Guenther <richard.guenther@gmail.com>
To: gcc-patches@gcc.gnu.org, Martin Jambor <mjambor@suse.cz>,
	richard.sandiford@linaro.org
Subject: Re: Fix type of SRAed enum accesses
Date: Tue, 27 Sep 2011 16:17:00 -0000	[thread overview]
Message-ID: <CAFiYyc1VhVu906C0B=AOnOY93GkbXyz+jXDq6PpowYoaYV8HKw@mail.gmail.com> (raw)
In-Reply-To: <g4r532ukn8.fsf@richards-thinkpad.stglab.manchester.uk.ibm.com>

On Tue, Sep 27, 2011 at 4:26 PM, Richard Sandiford
<richard.sandiford@linaro.org> 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?

Ok.

Thanks,
Richard.

> 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
>

  reply	other threads:[~2011-09-27 14:43 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-27 15:36 Richard Sandiford
2011-09-27 16:17 ` Richard Guenther [this message]
2011-09-27 16:44 ` Martin Jambor
2011-10-18 12:30 ` [4.6] " Jakub Jelinek
2011-10-19  8:43   ` Richard Guenther

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAFiYyc1VhVu906C0B=AOnOY93GkbXyz+jXDq6PpowYoaYV8HKw@mail.gmail.com' \
    --to=richard.guenther@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=mjambor@suse.cz \
    --cc=richard.sandiford@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).