------- Comment #1 from fxcoudert at gcc dot gnu dot org  2007-03-30 12:49 
-------
(In reply to comment #0)
> the loop count should be
> changed from
>   count = (to + step - from) / step
> to something else that cannot overflow.

I think it should be:

unsigned count = (step>0 ? to<from : to>from) ? 0 : 1 +
(unsigned)((to-from)/step)


-- 


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

Reply via email to