This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix PR tree-opt/17529, ICE due to *&a not being foldedto a[0]
- From: Jeffrey A Law <law at redhat dot com>
- To: Andrew Pinski <pinskia at physics dot uc dot edu>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Wed, 27 Oct 2004 11:01:19 -0600
- Subject: Re: [PATCH] Fix PR tree-opt/17529, ICE due to *&a not being foldedto a[0]
- Organization: Red Hat, Inc
- References: <35DA558C-2559-11D9-8879-000A95D692F4@physics.uc.edu>
- Reply-to: law at redhat dot com
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