while loop

Chandra Chavva cchavva@cygnus.com
Thu Feb 24 14:13:00 GMT 2000


On Thu, 24 Feb 2000, Jeffrey A Law wrote:

> 
>   In message <200002231940.LAA02269@cygnus.com>you write:
>   > > Anyways, I tried looking at ChangeLog entries for check_dbra_loop, of whi
>   > ch
>   > > there are only a few, and one very obvious one stood out:
>   > >         * loop.c (check_dbra_loop): Check bl->biv->add_val is a
>   > >         CONST_INT before using its INTVAL.
>   > > That will probably fix your problem.
>   > > 
>   > 
>   > This change doesnot fix my testcase,
> I'm not surprised.  The failure mode for the bug fixed by that change is
> using a totally weird constant for the loop counter increment/decrement.
> I'm pretty sure there's a test in the testsuite for this bug.

  I did find the testcase, so i added the following testcase to 
gcc/testsuite/gcc.c-torture/execute directory.

int loop_1 = 100;
int loop_2 = 7;
int flag = 0;

int test (void)
{
    int i;
    int counter  = 0;

    while (loop_1 > counter) {
        if (flag & 1) {
            for (i = 0; i < loop_2; i++) {
                counter++;
            }
        }
        flag++;
    }
    return 1;
}

int main()
{
    if (test ())
      abort (0);
    
    exit (0);
}

Thanks
Chandra



More information about the Gcc-patches mailing list