https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80721

--- Comment #4 from rguenther at suse dot de <rguenther at suse dot de> ---
On Fri, 12 May 2017, meisenmann....@fh-salzburg.ac.at wrote:

> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80721
> 
> --- Comment #3 from Markus Eisenmann <meisenmann....@fh-salzburg.ac.at> ---
> Hi Richard!
> 
> And now a less-intrusive (suggested) patch to do also a "right" merge
> [Sorry, also udiff-like but not fully formatted/with line-info; to see "my"
> idea]
> 
> ----
>           free_entry **fe;
>           for (fe = &first_free_entry;
>                (*fe)->next
>                && (reinterpret_cast <char *> ((*fe)->next)
>                    > reinterpret_cast <char *> (e) + sz);
>                fe = &(*fe)->next)
>             ;
> +         // If the next/right block follows immediately to the end of the
> block
> +         // to free, add its size to current 'free' and unlink it from the
> list.
> +         if (reinterpret_cast <char *> (e) + sz
> +             == reinterpret_cast <char *> ((*fe)->next))
> +         {
> +           sz += ((*fe)->next)->size;
> +           (*fe)->next = ((*fe)->next)->next;
> +         }
>           if (reinterpret_cast <char *> (*fe) + (*fe)->size
>               == reinterpret_cast <char *> (e))
>             /* Merge with the freelist entry.  */
>             (*fe)->size += sz;
> ----
> 
> Best regards from Salzburg,
> Markus
> 
> P.S.: Should I add a (well-formatted) patch-file, containing these two
> proposals?

I'll deal with it and testing / posting the patch.  Thanks!

Reply via email to