[Bug fortran/31399] Wrong code for do loop with large interation count
hjl at lucon dot org
gcc-bugzilla@gcc.gnu.org
Mon May 21 20:36:00 GMT 2007
------- Comment #8 from hjl at lucon dot org 2007-05-21 21:36 -------
According to the comment, before the change, we performed
[evaluate loop bounds and step]
count = (to + step - from) / step;
dovar = from;
for (;;)
{
body;
cycle_label:
dovar += step
count--;
if (count <=0) goto exit_label;
}
exit_label:
After the change, we did
[evaluate loop bounds and step]
empty = (step > 0 ? to < from : to > from);
countm1 = (to - from) / step;
dovar = from;
if (empty) goto exit_label;
for (;;)
{
body;
cycle_label:
dovar += step
countm1--;
if (countm1 ==0) goto exit_label;
}
exit_label:
Didn't we do one loop less than before?
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=31399
More information about the Gcc-bugs
mailing list