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: array bound violation in reg-stack.c



  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


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