This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: patch for loop bug (fwd)
- To: Jeffrey A Law <law at cygnus dot com>
- Subject: Re: patch for loop bug (fwd)
- From: Chandra Chavva <cchavva at cygnus dot com>
- Date: Mon, 17 Jul 2000 10:58:13 -0700 (PDT)
- cc: gcc-patches at gcc dot gnu dot org
Hi Jeff,
On Mon, 17 Jul 2000, Jeffrey A Law wrote:
> In message <Pine.SOL.3.91.1000711122952.2307P-100000@emperor.cygnus.com>you w
> rite:
> >
> >
> >
> > ---------- Forwarded message ----------
> > Date: Tue, 11 Jul 2000 12:15:29 -0700 (PDT)
> > From: Chandra Chavva <cchavva@emperor.cygnus.com>
> > To: gcc-patches@gcc.gnu.org
> > Subject: patch for loop bug
> >
> >
> > Here is the patch which fixes the following 'C' program. Please let me
> > know if it is okay to apply.
> >
> >
> > while.c
> >
> > int main()
> > {
> > int i = 1;
> > int j = 0;
> >
> > while (i != 1024 || j <= 0) {
> > i *= 2;
> > ++ j;
> > }
> >
> > if (j != 10)
> > abort ();
> >
> > exit (0);
> > }
> >
> > I have added this testcase to gcc testsuite - gcc.c-torture/execute/2000071
> > 1-1.c
> The test is fine. Please install it.
>
>
> > * loop.c (check_dbra_loop): Check if more than one condition
> > controls the loop.
> >
> >
> > Index: loop.c
> > ===================================================================
> > RCS file: /cvs/gcc/egcs/gcc/loop.c,v
> > retrieving revision 1.256
> > diff -p -r1.256 loop.c
> > *** loop.c 2000/06/14 07:41:57 1.256
> > --- loop.c 2000/07/11 19:01:41
> > *************** check_dbra_loop (loop, insn_count)
> > *** 7795,7800 ****
> > --- 7795,7811 ----
> > else
> > return 0;
> >
> > + {
> > + /* If more than one condition is present to control the loop, then
> > + do not procceed as the this function makes decision on the
> > + condition (JUMP_INSN) present just before NOTE_INSN_LOOP_END. */
> > +
> > + rtx jump1;
> > + if ((jump1 = prev_nonnote_insn (jump)) != loop_continue)
> > + if (GET_CODE (jump1) == JUMP_INSN))
> > + return 0;
> > + }
> > +
> I would slightly change the comment. Is this version accurate?
>
> " ... as this function does not know how to rewrite loop tests with more
> than one condition. */
>
> If it's more accurate/readable, then you should install the change with
> the updated comment. If the comment is not more accurate, then we should
> iterate once more on the patch.
>
Yes, it is more clear with your comments.
Thanks
Chandra