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

--- Comment #10 from Richard Biener <rguenth at gcc dot gnu.org> ---
(In reply to Tamar Christina from comment #8)
> C testcase
> 
> typedef struct {
>     int _M_current;
> } __normal_iterator;
> 
> typedef struct {
>     char _M_elems[5];
> } array_5;
> 
> __normal_iterator __trans_tmp_1 = {0};
> 
> array_5 copySourceIntoTarget() {
>     array_5 target;
>     char* target_it = target._M_elems;
> 
>     while (__trans_tmp_1._M_current != 0) {
>         *target_it = 0;
>         __trans_tmp_1._M_current++;
>         target_it++;
>     }
> 
>     return target;
> }
> 
> compiled with -mcpu=neoverse-n2 -O1 -ftree-loop-vectorize
> 
> The cost model for Neoverse-N2 is needed to get it to generate an Adv.SIMD
> main loop and an SVE trailing loop.

So the issue seems to be that DSE sees the .MASK_STORE after the epilog
is dead because it is to &target + _55 + POLY_INT_CST[16, 16].  Given
pointers may not "advance" to before an object we get an ao_ref with base

&target + _55

and offset = POLY_INT_CST[16, 16]

that is always out of char _M_elems[5].

So, iff that pointer increment by _55 is say for alignment peeling via mask
with
a negative bias that pointer arithmetic invokes UB and has to be done
in uintptr_t.

Reply via email to