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

--- Comment #12 from bin cheng <amker at gcc dot gnu.org> ---
(In reply to Jakub Jelinek from comment #10)
> Actually (int) ((ivtmp.11 - (unsigned long) dst_10) / 4), sorry.
> On 64-bit targets this will never be a problem, are you worried about 32-bit
> targets where int and pointers are the same width and for a loop with say up
> to INT_MAX iterations ivtmp.11 would wrap around?  Then dst[i] would be
> invalid too.
> So as long as the IVs aren't added there out of the blue sky, with larger
> steps than what is really used, it shouldn't be an issue.
> Or can say a loop that does:
> unsigned int j = x;
> for (int i = 0; i < n; i++)
>   {
>     j += 32;
>     use (i, j);
>   }
> use j as unsigned int IV with step 32 replace the i int IV with step 1?  If
> yes, then I'd understand that (int) ((j - x) / 32) might not be correct
> expression all the time, e.g. if j == x, then i might be 0, or 0x8000000
> etc., but (int) ((j - x) / 32) will be 0.

Yes, as mentioned in #11, we need to choose the same class IV in rewriting. 
And reuse of existing code makes it harder, after all, I don't want to disturb
existing code because of debug-stmt rewriting.

Reply via email to