The following patch "fixes" this by imitating ref_contains_array_ref semantics. Bootstrapped on x86_64-unknonw-linux-gnu, regtest in progress, ok for mainline if it succeeds?
Wouldn't this be simpler: static inline bool ref_contains_indirect_ref (tree ref) { while (handled_component_p (ref)) ref = TREE_OPERAND (ref, 0); return TREE_CODE (ref) == INDIRECT_REF; } ??