This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: array bound violation in reg-stack.c
- To: Herman ten Brugge <Haj dot Ten dot Brugge at net dot HCC dot nl>
- Subject: Re: array bound violation in reg-stack.c
- From: Jeffrey A Law <law at cygnus dot com>
- Date: Fri, 06 Aug 1999 23:57:17 -0600
- cc: egcs-patches at egcs dot cygnus dot com
- Reply-To: law at cygnus dot com
In message <199907161921.UAA02927@net.HCC.nl>you write:
> while (old->reg[old->top] != new->reg[new->top])
>
> The value of 'old->top' and 'new->top' can be -1. This will result
> in some random data being used for the compare. This problem is present
> since gcc-2.7.2.1.
> The patch to fix this is simple:
>
> 1999-07-13 Herman A.J. ten Brugge <Haj.Ten.Brugge@net.HCC.nl>
>
> * reg-stack.c (change_stack) Fixed problem with negative array
index
Thanks. A style note -- we do not write "if (cond) do ..."
Instead write
if (cond)
do
...
I fixed the style problem, indented the code properly, added a suitable
comment for why this is the right change and installed your patch on the
branch as well as the mainline sources.
Thanks,
jeff