This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Loop unroll fixes


> 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;
}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]