[PATCH][libstdc++-v3 parallel mode] Default constructor/placement new issues

Johannes Singler singler@ira.uka.de
Wed Nov 28 15:47:00 GMT 2007


Chris Jefferson brought a problem of incorrect (de)construction because
of raw allocation + placement new to my attention. So I checked the
whole code for similar problems and fixed them. One remains (not easy to
fix), but in a variant that is by default deactivated (and might get
thrown out anyway).

The raw allocation + placement new with copy constructor is sometimes
necessary to avoid calling the default constructor, which might be
unavailable.

Tested x86_64-unknown-linux-gnu: No regressions.

Please approve.

2007-11-28  Johannes Singler  <singler@ira.uka.de>

        * include/parallel/multiway_merge.h:
           Destruct only elements that were have been constructed before
           Code beautifying and formatting
        * include/parallel/losertree.h:
           (Copy) construct all loser tree item keys, so they can be
           deconstructed all at once
        * include/parallel/quicksort.h: Fix memory leak
        * include/parallel/random_shuffle.h:
            Use copy constructor instead of assignment
            Code beautifying and formatting
        * include/parallel/unique_copy.h:
            Use assignment instead of copy constructor
        * include/parallel/multiway_mergesort.h:
            Use copy constructor instead of assignment
            Code beautifying and formatting
        * include/parallel/random_shuffle.h:
            Use copy constructor instead of assignment
            Code beautifying

Johannes

-------------- next part --------------
A non-text attachment was scrubbed...
Name: placement_new.patch
Type: text/x-patch
Size: 45161 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20071128/e8eaf003/attachment.bin>


More information about the Libstdc++ mailing list