public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <richard.guenther@gmail.com>
To: Eric Botcazou <ebotcazou@adacore.com>
Cc: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [patch] Fix ICE on unaligned record field
Date: Fri, 12 Dec 2014 09:22:00 -0000	[thread overview]
Message-ID: <CAFiYyc2wdLiP9OAO55Efi-+SBv+=1xLwv+WPVb7fg2YN1NvU1g@mail.gmail.com> (raw)
In-Reply-To: <1522896.5Ls1L3QkSH@polaris>

On Thu, Dec 11, 2014 at 10:52 PM, Eric Botcazou <ebotcazou@adacore.com> wrote:
>> Note that I think the place of the check is unfortunate as you for example
>> will not remove the argument if it is unused.  In fact I'm not yet sure
>> what transform exactly we are disabling.  I am guessing we are
>> passing an aggregate by value that resides at a bit-aligned offset
>> of some outer object:
>>
>>   foo (x.aggr);
>>
>> and the function then does
>>
>> foo (Aggr a)
>> {
>>   int i = a.foo;
>> ...
>> }
>>
>> thus use only a part of the aggregate.  Then IPA SRA would like to
>> pass x.aggr.foo instead of x.aggr and thus tries to materialize a
>> load from x.aggr.foo at all callers but fails to do that in a valid way.
>
> Right, it's the usual MEM_EXPR business creating ADDR_EXPRs out of nowhere and
> miserably failing on something not addressable.

Well, I call it a convenience that MEM_EXPR, unlike INDIRECT_REF, can
be used to encapsulate an arbitrary byte-offset and view-conversion.  Of course
it's still a dereference of an address so that convenience doesn't work on sth
non-addressable.

>> Erics fix did, at all callers
>>
>>   Aggr tem = x.aggr;
>>   foo (tem.foo);
>>
>> ?
>
> Yes, because the code wants to take &tem afterwards.
>
>> While we should be able to simply do
>>
>>   foo (BIT_FIELD_REF <x.aggr, .....>)
>>
>> with the appropriate bit offset and size?  (if that's of register type
>> you need to do the load in a separate stmt of couse).
>>
>> Thus similar to Erics fix but avoiding the aggregate copy.
>
> Yes, that should be doable, but I'm not sure it's worth the hassle.

I'll leave that to you two to decide - Martins patch is ok if you are fine
with disabling the optimization (also removing an unused parameter).

Thanks,
Richard.

> --
> Eric Botcazou

  reply	other threads:[~2014-12-12  9:22 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-28 17:09 Eric Botcazou
2014-12-01 11:00 ` Richard Biener
2014-12-03 14:02   ` Martin Jambor
2014-12-10 11:31     ` Eric Botcazou
2014-12-10 14:01     ` Richard Biener
2014-12-11 21:53       ` Eric Botcazou
2014-12-12  9:22         ` Richard Biener [this message]
2014-12-12 10:51           ` Eric Botcazou
2015-01-06 17:08     ` Eric Botcazou
2015-02-25 15:49       ` Martin Jambor
2015-02-28 16:42         ` Eric Botcazou
2015-03-03 18:34         ` H.J. Lu

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='CAFiYyc2wdLiP9OAO55Efi-+SBv+=1xLwv+WPVb7fg2YN1NvU1g@mail.gmail.com' \
    --to=richard.guenther@gmail.com \
    --cc=ebotcazou@adacore.com \
    --cc=gcc-patches@gcc.gnu.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).