Robert Dewar <[EMAIL PROTECTED]> writes: | Gabriel Dos Reis wrote: | | > As we have briefly discussed in mails, the most critical part of the | > issue seems to be what can be assumed for loop variables. I countend | > that for many if not most practical loops, the variable can be assumed | > not to overflow and apply the transformation. But we need not apply | > "undefined behaviour" to all other cases; only for those | > "well-written" loop and loop variables. In summary, if user's loop is | > well-written then he will benefit from the transformation. That will | > cover already a good set of common loops. | | Note that the lack of a FOR loop in C adds to the problems here. In
This is why I think a switch is useful here. The programmer may know more about his/her loops than the current GCC infrastructure may prove. Furthermore, the blanket statement of lack of a "FOR loop" does not preclude existence of properly writeen FOR loop. We should be able to do conservative analysis and catch those. If, User writes for (int i = min; i < max; ++i) .... and i, min and max don't change in the body, no matter what you think of C's general "for" not being a FOR loop, the above is a FOR loop. -- Gaby