This is the mail archive of the gcc-bugs@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]
Other format: [Raw text]

[Bug libstdc++/80721] New: Sorting/Merging of free EH-emergency buffer may wrong or uncomplete


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

            Bug ID: 80721
           Summary: Sorting/Merging of free EH-emergency buffer may wrong
                    or uncomplete
           Product: gcc
           Version: 6.3.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: meisenmann.lba@fh-salzburg.ac.at
  Target Milestone: ---

Created attachment 41345
  --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=41345&action=edit
Suggested patch to fix order/fragmentation-issue in EH-emergency free-list

Hi!

My following findings describing "only" a minor issue and I'm not sure, whether
this can occur in "real life" or it's important (because, it's for a low-memory
situation):

If EH-emergency buffer are not free in reverse order of allocation, the order
of the free-list may wrong or not all possible merges are processed.

a) If the free-list is empty or the block to free is directly right of the
first item, this free-block is put as head (maybe after merge).
But, if the free-block is left to the first item and not merge-able, it is
sorted/put in as second item (instead of new first head).

b) If a block (to free) has a direct left free-block, it is merged into this;
but there's no check/merge to a direct following right free-block
[-> sub-optimal "fragmentation" within the free list].

IMHO, I will provide a suggested patch (with refactoring/simplification ...
... free to be used, if you are also see this as issue).


Best regards from Salzburg,
Marks

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