Loop unroll fixes
Zoltan Hidvegi
hzoli@hzoli.2y.net
Thu Oct 25 07:30:00 GMT 2001
> You're saying that GCC has a long-standing bug whereby some infinite
Earlier yoday, I showed a testcase for that infinite loop, but that
was using ints. The same example can be converted to unsigned ints,
when gcc-2.95.x no longer fails, but gcc-3.0 and later still does.
gcc-2.95.x only used the ctr if it was an increment by 1 loop with
signed loop variable. The unsigned example is shown below.
Zoli
void abort(void);
unsigned int
infinite(unsigned int c)
{
unsigned int i;
unsigned int ct = 0;
for (i = 3; i >= c; i--)
ct++;
return ct;
}
int
main(void)
{
if (infinite(0))
abort();
return 0;
}
More information about the Gcc-patches
mailing list