I was improving tree aliasing for pointers by adding support a+1 and a not aliasing. But I ran into a bug in the aliasing where: /* If both references are through the same type, they do not alias if the accesses do not overlap. This does extra disambiguation for mixed/pointer accesses but requires strict aliasing. */ if (same_type_for_tbaa (TREE_TYPE (TREE_TYPE (ptr1)), TREE_TYPE (TREE_TYPE (ptr2))) == 1) return ranges_overlap_p (offset1, max_size1, offset2, max_size2);
Would return false even. I can't see how this can be true if one pointer is defined as an offset as the other and the offset1 or offset2 are non zero. Can someone explain why this is true? Even nonaliasing_component_refs_p looks to have the same issue if the types are the same, they could be an extra offset from each other, even though the compiler cannot figure that out. I am thinking of when storing the pointer in an array and then accessing that pointer. gcc.dg/20030324-1.c is the testcase where I am running into this bug too. Thanks, Andrew Pinski