Dave Korn - RE: [PATCH] Re: ref_contains_indirect_ref always false? (original) (raw)

This is the mail archive of the gcc@gcc.gnu.orgmailing 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]

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....


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