public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "greg dot bertin at solacesystems dot com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libstdc++/13864] stl_hastable.h Line 527
Date: Mon, 26 Jan 2004 14:20:00 -0000	[thread overview]
Message-ID: <20040126142058.29849.qmail@sources.redhat.com> (raw)
In-Reply-To: <20040126054235.13864.greg.bertin@solacesystems.com>


------- Additional Comments From greg dot bertin at solacesystems dot com  2004-01-26 14:20 -------
Subject: RE:  stl_hastable.h Line 527

Hi pinskia ...

__n is initialized but the memory being pointed at by __n is not. It is
memory allocated via _M_get_node():

  _Node* _M_get_node() { return _M_node_allocator.allocate(1); } 

Allocators return uninitialized memory blocks. This is a problem because
_Construct():

  template <class _T1, class _T2>
    inline void
    _Construct(_T1* __p, const _T2& __value)
    { new (static_cast<void*>(__p)) _T1(__value); }

assumes that __p points to a properly initialized T1 object since it
invokes T1's copy constructor. T1's copy constructor will assume that
T1's members (e.g. pointer members that are not NULL and thus need to be
deallocate()'d/delete()'d/free()'d/whatever) have been properly
initialized. The other uses of _Construct() in the standard STL that I
checked all pass a properly initialized __p to _Construct and thus
behave correctly.


Thanks for looking at this!!

> -----Original Message-----
> From: pinskia at gcc dot gnu dot org [mailto:gcc-bugzilla@gcc.gnu.org]
> Sent: Monday, January 26, 2004 8:24 AM
> To: greg.bertin@solacesystems.com
> Subject: [Bug libstdc++/13864] stl_hastable.h Line 527
> 
> 
> ------- Additional Comments From pinskia at gcc dot gnu dot org
2004-01-
> 26 13:23 -------
> Here is the full source, n __n is initialized:
>   _Node* _M_new_node(const value_type& __obj)
>   {
>     _Node* __n = _M_get_node();
>     __n->_M_next = 0;
>     try {
>       _Construct(&__n->_M_val, __obj);
>       return __n;
>     }
>     catch(...)
>       {
>         _M_put_node(__n);
>         __throw_exception_again;
>       }
>   }
> 
> --
>            What    |Removed                     |Added
>
------------------------------------------------------------------------
--
> --
>              Status|UNCONFIRMED                 |RESOLVED
>          Resolution|                            |INVALID
> 
> 
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13864
> 
> ------- You are receiving this mail because: -------
> You reported the bug, or are watching the reporter.




-- 


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


  parent reply	other threads:[~2004-01-26 14:20 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-26  5:42 [Bug libstdc++/13864] New: " greg dot bertin at solacesystems dot com
2004-01-26  6:38 ` [Bug libstdc++/13864] " gdr at integrable-solutions dot net
2004-01-26 13:23 ` pinskia at gcc dot gnu dot org
2004-01-26 14:20 ` greg dot bertin at solacesystems dot com [this message]
2004-01-26 14:27 ` greg dot bertin at solacesystems dot com
2004-01-26 14:28 ` greg dot bertin at solacesystems dot com
2004-01-26 14:30 ` pinskia at gcc dot gnu dot org
2004-01-26 14:41 ` gdr at integrable-solutions dot net

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20040126142058.29849.qmail@sources.redhat.com \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).