[Bug libstdc++/48750] for_each_template_random_access_ed has unbalanced new/delete[]

singler at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Wed Apr 27 20:00:00 GMT 2011


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48750

singler@gcc.gnu.org <singler at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |singler at gcc dot gnu.org

--- Comment #16 from singler at gcc dot gnu.org <singler at gcc dot gnu.org> 2011-04-27 19:59:29 UTC ---
I have reviewed the patch, it looks mostly fine.  Thanks!
Only line 606 of losertree.h might not yet be fully consistent with line 597. 
I'm not sure all loser tree members are correctly constructed in the first
place.

We might have to add

        for (unsigned int __i = 0; __i < _M_k; ++__i)
          {
            ::new(&(_M_losers[__i]._M_key)) _Tp(__sentinel);
            _M_losers[__i]._M_source = -1;
          }

I will test that...

We have used these ::operator new/placement new construction to avoid calling
the default constructor, which might not be available for the ValueType. 
Interference with the actual parallelism should be minimal.



More information about the Gcc-bugs mailing list