This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: Bug: loop incr optimised to a constant
- To: Franz Sirl <Franz dot Sirl-kernel at lauterbach dot com>
- Subject: Re: Bug: loop incr optimised to a constant
- From: Mark Powell <medp at primag dot co dot uk>
- Date: Wed, 10 Nov 1999 12:35:03 -0000 (GMT)
- Cc: gcc-bugs at gcc dot gnu dot org
- Organization: Primagraphics Ltd.
Franz,
Yes it fixes the bug on both my m68k-unknown-coff and sparc-sun-solaris2.7
configurations (gcc-2.95.2).
thank you for finding this.
--
Mark Powell, Senior Software Engineer, Primagraphics Limited
New Cambridge House, Litlington, nr.Royston, Herts, SG8 0SS, UK
Tel. +44 1763 852222, Fax. 853324, medp@primag.co.uk, http://www.primag.co.uk
On 09-Nov-99 Franz Sirl wrote:
> At 15:02 08.11.99 , Franz Sirl wrote:
> >Unless one of the loop experts tackles this, I will look at that later
> >today or tomorrow.
>
> The appended little patch from the mainline sources solves this problem
> for
> me. Mark, please try the patch on your platform. If it fixes the problem
> for you too, the patch should go into the release branch.
>
> Franz.
>
> 1999-08-31 12:20 -0700 Zack Weinberg <zack@bitmover.com>
> * loop.c (check_dbra_loop): Check bl->biv->add_val is a
> CONST_INT before using its INTVAL.
>
> Index: loop.c
> ===================================================================
> RCS file: /cvs/gcc/egcs/gcc/loop.c,v
> retrieving revision 1.179
> retrieving revision 1.180
> diff -u -p -r1.179 -r1.180
> --- loop.c 1999/08/29 10:09:28 1.179
> +++ loop.c 1999/08/31 19:39:05 1.180
> @@ -7797,7 +7797,8 @@ check_dbra_loop (loop_end, insn_count, l
> }
> }
> }
> - else if (INTVAL (bl->biv->add_val) > 0)
> + else if (GET_CODE (bl->biv->add_val) == CONST_INT
> + && INTVAL (bl->biv->add_val) > 0)
> {
> /* Try to change inc to dec, so can apply above optimization. */
> /* Can do this if: