This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Re: ref_contains_indirect_ref always false?
- From: Daniel Berlin <dberlin at dberlin dot org>
- To: Diego Novillo <dnovillo at redhat dot com>
- Cc: Richard Kenner <kenner at vlsi1 dot ultra dot nyu dot edu>, Richard Guenther <rguenther at suse dot de>, gcc-patches at gcc dot gnu dot org, gcc at gcc dot gnu dot org
- Date: Fri, 04 Nov 2005 11:01:51 -0500
- Subject: Re: [PATCH] Re: ref_contains_indirect_ref always false?
- References: <10511041507.AA09327@vlsi1.ultra.nyu.edu> <200511041017.32255.dnovillo@redhat.com>
On Fri, 2005-11-04 at 10:17 -0500, Diego Novillo wrote:
> On Friday 04 November 2005 10:07, Richard Kenner wrote:
> > #if defined ENABLE_CHECKING
> > gcc_assert (handled_component_p (ref))
> > #endif
> >
> > If the comment says it has to be an ARRAY_REF, why not just check for
> > that?
>
> The comment is out of sync with the code. It's used in code that may be
> sending an arbitrary aggregate.
>
> Given that Dan asked to remove the call from tree-ssa-structalias.c, then
> we can take advantage and tighten the two predicates more.
>
> In ref_contains_indirect_ref:
> Rename to array_ref_contains_indirect_ref
> Add gcc_assert (TREE_CODE (ref) == ARRAY_REF) at the start.
This would be fine.
The use in tree-ssa-loop-niter.c is really trying to skip out on
inferring loop bounds from pointer to structure accesses in the case of
things like:
struct a
{
char foo[1];
};
struct a *b = malloc (sizeof (struct a) + 100);
b->foo = "I like candy!"
Since we have to keep this working:)
Thus, it should *always* be handed an ARRAY_REF.