This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c/36691] New: wrong value left in induction variable
- From: "regehr at cs dot utah dot edu" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 1 Jul 2008 22:39:39 -0000
- Subject: [Bug c/36691] New: wrong value left in induction variable
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
This is seen using svn 137327 on Ubuntu Feisty. I believe 0 is the correct
result.
[regehr@babel tmp35]$ current-gcc -O0 -fwrapv small.c -o small
[regehr@babel tmp35]$ ./small
0
[regehr@babel tmp35]$ current-gcc -O1 -fwrapv small.c -o small
[regehr@babel tmp35]$ ./small
255
[regehr@babel tmp35]$ current-gcc -v
Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: ../configure --program-prefix=current-
--enable-languages=c,c++ --prefix=/home/regehr
Thread model: posix
gcc version 4.4.0 20080701 (experimental) (GCC)
[regehr@babel tmp35]$ cat small.c
#include <stdio.h>
unsigned char g_5;
void func_1 (void);
void func_1 (void)
{
for (g_5 = -7; g_5 >= 4; g_5 -= 5);
}
int main (void)
{
func_1 ();
printf ("%d\n", g_5);
return 0;
}
--
Summary: wrong value left in induction variable
Product: gcc
Version: 4.4.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: regehr at cs dot utah dot edu
GCC build triplet: i686-pc-linux-gnu
GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36691