[PATCH] ggc-page loop
Richard Biener
richard.guenther@gmail.com
Wed May 3 10:02:00 GMT 2017
On Wed, May 3, 2017 at 2:09 AM, Andrew Pinski <pinskia@gmail.com> wrote:
> 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;
He does, albeit in a coding way I dislike (watch how the iterator
update is done in the condition!)
Richard.
>
> Thanks,
> Andrew
>
>
>>
>> nathan
>> --
>> Nathan Sidwell
More information about the Gcc-patches
mailing list