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

Jeffrey A Law law@redhat.com
Thu Oct 28 03:19:00 GMT 2004


On Wed, 2004-10-27 at 13:17 -0400, Andrew Pinski wrote:
> 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.
OK.  I missed the comment which indicated that test only failed
during a short window of time on the mainline.

The patch is OK.

Thanks,
Jef



More information about the Gcc-patches mailing list