[Bug libstdc++/80721] Sorting/Merging of free EH-emergency buffer may wrong or uncomplete
meisenmann.lba@fh-salzburg.ac.at
gcc-bugzilla@gcc.gnu.org
Fri May 12 10:01:00 GMT 2017
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80721
--- Comment #3 from Markus Eisenmann <meisenmann.lba@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?
More information about the Gcc-bugs
mailing list