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.