public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jeffrey A Law <law@redhat.com>
To: Andrew Pinski <pinskia@physics.uc.edu>
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:10:00 -0000	[thread overview]
Message-ID: <1098896479.5943.22.camel@localhost.localdomain> (raw)
In-Reply-To: <35DA558C-2559-11D9-8879-000A95D692F4@physics.uc.edu>

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.


>  So what I did was to patch remove_useless_stmts_1
> to do the folding for us (this is already done for the second testcase
> in the PR, for MODIFY_EXPR).  I also removed the case for SWITCH_EXPR
> in remove_useless_stmts_1 because it was not needed at all and just
> slowed us down.
> 
> OK? Bootstrapped and tested on powerpc-darwin.
> 
> 
> 
> ChangeLog:
> 
> 	* tree-cfg.c (remove_useless_stmts_1) <case SWITCH_EXPR>:
> 	Don't fold statement.
> 	<case ASM_EXPR>: Fold the statement.
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);
}

[ Shouldn't this variant have a test in the testsuite as well? ]

Which seems to indicate you're attacking this in the wrong place.

Jeff

  reply	other threads:[~2004-10-27 17:01 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 [this message]
2004-10-27 17:30   ` Andrew Pinski
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=1098896479.5943.22.camel@localhost.localdomain \
    --to=law@redhat.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=pinskia@physics.uc.edu \
    /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).