------- Comment #4 from rakdver at kam dot mff dot cuni dot cz  2010-08-27 
16:33 -------
Subject: Re:   New: Number of iteration
        analysis bogus

> when looking at the exit 6->7 number_of_iterations_ne is present with
> iv->base (cxb3014__test_block__char_pointers__element * {ref-all}) ref_4(D)
> and final 0B, the step is 1.  We then do
> 
>   else
>     {
>       s = fold_convert (niter_type, iv->step);
>       c = fold_build2 (MINUS_EXPR, niter_type,
>                        fold_convert (niter_type, final),
>                        fold_convert (niter_type, iv->base));
>     }
> 
> which creates -(UNSIGNED_64) ref_4(D) for c, with no_overflow set as we
> do for pointers (but note we now have unsigned_type_for, a non-pointer!)

This looks correct to me, as far as I can tell.  The original induction
variable
has pointer type, and thus it cannot overflow without causing undefined
behavior.

I do not understand the problem; what would you expect the result of the
analysis to be?


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45427

Reply via email to