On Mar 10, 2016 1:21 PM, "Eirik Byrkjeflot Anonsen" <[email protected]> wrote: > > Ian Romanick <[email protected]> writes: > > > From: Ian Romanick <[email protected]> > > > > I don't understand why the old code was bad, but the new code is fine. > > Probably because the *loop counter* can no longer overflow. Thus the > loop can be optimized. The fact that "i" might overflow has become > irrelevant to the warning.
Right. In theory, since i is incremented by 4 each time it could, in theory, skip right over size/4 and overflow. However, this can never happen since size is 32 bits and is divided by 4 so it has a maximum value of 2^30-1. Apparently, GCC isn't quite that smart. :-) > (And from that perspective, it isn't equivalent. If "i" overflows in the > original code, you would get an infinite loop.) > > eirik > _______________________________________________ > mesa-dev mailing list > [email protected] > https://lists.freedesktop.org/mailman/listinfo/mesa-dev
_______________________________________________ mesa-dev mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/mesa-dev
