This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug middle-end/36691] [4.2/4.3/4.4 Regression] wrong value left in induction variable
- From: "rguenth at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 4 Aug 2008 13:00:23 -0000
- Subject: [Bug middle-end/36691] [4.2/4.3/4.4 Regression] wrong value left in induction variable
- References: <bug-36691-12544@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #6 from rguenth at gcc dot gnu dot org 2008-08-04 13:00 -------
Slightly differently "worded" the testcase is
unsigned int g_5;
void func_1 (void)
{
for (g_5 = 9; g_5 >= 4; g_5 -= 5)
;
}
extern void abort (void);
int main (void)
{
func_1 ();
if (g_5 != 0)
abort ();
return 0;
}
so the loop wraps once (9, 4, UINT_MAX, ..., 5, 0).
>From the scev-cprop dump we see that the number of iterations is wrong:
Analyzing # of iterations of loop 1
exit condition 3 < [4, + , 4294967291]
bounds on difference of bases: 1 ... 1
result:
# of iterations 1, bounded by 1
(set_nb_iterations_in_loop = 1))
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=36691