Should GCC publish a general rule/warning due to it's default presumption of undefined signed integer overflow semantics?

Robert Dewar dewar@adacore.com
Sat Jul 2 16:51:00 GMT 2005


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
languages with FOR loops, this issue comes up very explicitly, but
at the code generation level, you have to be careful to generate
code that deals with the boundary cases correctly.




More information about the Gcc mailing list