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? 


  Given that we're supposed to be passing in an ARRAY_REF and we don't want it
to return true if passed in an INDIRECT_REF, why not just reverse the order of
the two statements in the body of the original while loop?

  Before:
> static inline bool
> ref_contains_indirect_ref (tree ref)
> {
>   while (handled_component_p (ref))
>     {
>       if (TREE_CODE (ref) == INDIRECT_REF)
>         return true;
>       ref = TREE_OPERAND (ref, 0);
>     }
>   return false;
> }

  After:
> static inline bool
> ref_contains_indirect_ref (tree ref)
> {
>   while (handled_component_p (ref))
>     {
>       ref = TREE_OPERAND (ref, 0);
>       if (TREE_CODE (ref) == INDIRECT_REF)
>         return true;
>     }
>   return false;
> }


    cheers,
      DaveK
-- 
Can't think of a witty .sigline today....

Reply via email to