This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] ggc-page loop
- From: Andrew Pinski <pinskia at gmail dot com>
- To: Nathan Sidwell <nathan at acm dot org>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>
- Date: Tue, 2 May 2017 17:09:53 -0700
- Subject: Re: [PATCH] ggc-page loop
- Authentication-results: sourceware.org; auth=none
- References: <075b8346-d1fa-719a-4a6f-6d0391c15e9c@acm.org>
On Tue, May 2, 2017 at 3:41 PM, Nathan Sidwell <nathan@acm.org> wrote:
> This loop in ggc-page confused me, because the iterator is one greater than
> the indexing value. Also the formatting of the array indexing is incorrect.
>
> Fixed thusly, and applied as obvious after booting on x86_64-linux-gnu
- for (i = G.by_depth_in_use; i > 0; --i)
+ for (unsigned i = G.by_depth_in_use; i--;)
{
- page_entry *p = G.by_depth[i-1];
- p->index_by_depth = i-1;
+ page_entry *p = G.by_depth[i];
+ p->index_by_depth = i;
}
I think this is still incorrect. you replaced i - 1 by i but did not
start at G.by_depth_in_use - 1;
Thanks,
Andrew
>
> nathan
> --
> Nathan Sidwell