https://gcc.gnu.org/bugzilla/show_bug.cgi?id=120817

--- Comment #13 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Tamar Christina from comment #12)
> Looks like the problem is that during ao_ref_init_from_ptr_and_range when
> initializing vectp_target.14_54 = &targetD.4595 + _55;
> 
> we don't enter the block splitting apart POINTER_PLUS_EXPR.
> 
> So it ends up creating a ref with the base being MEM_REF <&targetD.4595 +
> _55>
> 
> later on when checking of &targetD.4595 and MEM_REF <&targetD.4595 + _55>
> could alias in refs_may_alias_p it doesn't think these two can alias, even
> though
> 
>   # _38 = PHI <niters_vector_mult_vf.6_33(6), 0(3)>
>   # RANGE [irange] sizetype [0, 0][32, 4294967264] MASK 0xffffffe0 VALUE 0x0
>   _55 = (sizetype) _38;
> 
> 
> so clearly they can alias. Need to look into how tree-ssa-alias normally
> handles PHI offsets.

The problem is that _55 is negative.  But the alias oracle does not consider
negative offsets but only the 8B positive offset which makes the access
clearly out of bounds of &targetD.4595.

Do not use POINTER_PLUS_EXPR to "advance" a pointer to sth outside of
[&object, &object + sizeof(object)], since such a pointer is UB.

Reply via email to