------- Comment #1 from joseph at codesourcery dot com  2009-04-11 12:51 -------
Subject: Re:   New: signed overflow in loop
 induction variable: missing warning and wrong code

On Sat, 11 Apr 2009, edwintorok at gmail dot com wrote:

> Testcase:
> #include <stdio.h>
> int
> main ()
> {
>         int until = 40001;
>         short from = 0;
> 
>         for (; from < until; from++)
>                 printf ("%d\n", from);
> 
>         return 0;
> }

There is no undefined behavior here (increment of a short value converts 
to int, increments then converts back to short, none of which are 
undefined), so at least the wrong code issue would be the same as bug 
35634.


-- 


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

Reply via email to