This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Fix PR tree-opt/17529, ICE due to *&a not being foldedto a[0]


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]