public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Andrew Pinski <pinskia@physics.uc.edu>
To: law@redhat.com
Cc: GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] Fix PR tree-opt/17529, ICE due to *&a not being folded to a[0]
Date: Wed, 27 Oct 2004 17:30:00 -0000	[thread overview]
Message-ID: <10344B2B-283C-11D9-B7C0-000A95D692F4@physics.uc.edu> (raw)
In-Reply-To: <1098896479.5943.22.camel@localhost.localdomain>


On Oct 27, 2004, at 1:01 PM, Jeffrey A Law wrote:

> On Sat, 2004-10-23 at 21:08 -0400, Andrew Pinski wrote:
>> I think the subject says what causes the problem and the reason why
>> we don't fold *&a into a[0] is because fold does not handle it
>> but fold_stmt does.
> We might consider moving this logic into the fold one day, but I
> suspect that's more intrusive than we want to tackle right now.
>

> However, I don't think this will fix the other testcase in that
> PR:
>
> bar (const int *const x)
> {
>   int x1 = *x;
> }
> static const int y[1]={0};
> void
> foo (void)
> {
>   bar (y);
> }

The other test is already fixed by the fact we call fold_stmt on
MODIFY_EXPR already.  In fact the only two places in gimple
where INDIRECT_REF (at this point) can show up is ASM_EXPR
or a MODIFY_EXPR so all cases are already handled.

I tested the following the case where you might expect that the
INDIRECT_REF might show up not in either ASM_EXPR or a MODIFY_EXPR
but does not as we use a temporary variable to store the address:
struct t
{
   int i;
};
void f(const int*const);
bar (const struct t *const x)
{
   f(&x->i);
}
static const struct t y[1];
void
foo (void)
{
   bar (y);
}

Thanks,
Andrew Pinski

  reply	other threads:[~2004-10-27 17:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-24  3:07 Andrew Pinski
2004-10-27 17:10 ` Jeffrey A Law
2004-10-27 17:30   ` Andrew Pinski [this message]
2004-10-28  3:19     ` Jeffrey A Law

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=10344B2B-283C-11D9-B7C0-000A95D692F4@physics.uc.edu \
    --to=pinskia@physics.uc.edu \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=law@redhat.com \
    /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).