public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/29179]  New: bugs in mt_allocator
@ 2006-09-22 10:31 random at adriver dot ru
  2006-09-22 11:19 ` [Bug libstdc++/29179] " pcarlini at suse dot de
                   ` (8 more replies)
  0 siblings, 9 replies; 10+ messages in thread
From: random at adriver dot ru @ 2006-09-22 10:31 UTC (permalink / raw)
  To: gcc-bugs

This example will demonstrate 2 problems in mt_allocator.cc:

----------------
typedef __gnu_cxx::__mt_alloc<char> allocator_type;
typedef __gnu_cxx::__pool_base::_Tune tune_type;

allocator_type mt_char;
tune_type t(8, 40000, 8, (50000 - 4 * sizeof(void*)), 4096, 10, false);
mt_char._M_set_options(t);
allocator_type::pointer pc = mt_char.allocate(40000);
----------------

First bug in __pool<..>::_M_initialize():
        Binmap_type __bin_max = _M_options._M_min_bin;  // not correct.
        size_t __bin_max = _M_options._M_min_bin; // correct.


Second bug in __pool<..>::_M_reserve_block():

while (--__block_count > 0) // not correct because __block_count may be equal
0(and size_t is unsigned)
{
__c += __bin_size;
__block->_M_next = reinterpret_cast<_Block_record*>(__c);
__block = __block->_M_next;
}

  while (__block_count > 0) // correct
      {
        __c += __bin_size;
        __block->_M_next = reinterpret_cast<_Block_record*>(__c);
        __block = __block->_M_next;
       --__block_count;
      }


-- 
           Summary: bugs in mt_allocator
           Product: gcc
           Version: 4.1.1
            Status: UNCONFIRMED
          Severity: critical
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: random at adriver dot ru


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


^ permalink raw reply	[flat|nested] 10+ messages in thread

end of thread, other threads:[~2006-09-25 10:07 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-09-22 10:31 [Bug c++/29179] New: bugs in mt_allocator random at adriver dot ru
2006-09-22 11:19 ` [Bug libstdc++/29179] " pcarlini at suse dot de
2006-09-22 13:32 ` random at adriver dot ru
2006-09-22 13:42 ` pcarlini at suse dot de
2006-09-22 14:40 ` random at adriver dot ru
2006-09-22 14:48 ` pcarlini at suse dot de
2006-09-22 16:04 ` pinskia at gcc dot gnu dot org
2006-09-25 10:05 ` paolo at gcc dot gnu dot org
2006-09-25 10:06 ` paolo at gcc dot gnu dot org
2006-09-25 10:07 ` pcarlini at suse dot de

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).