[Patch] libstdc++/23465

chris jefferson caj@cs.york.ac.uk
Wed Aug 24 10:59:00 GMT 2005


Paolo Carlini wrote:

>Hi,
>
>the below is a complete fix for the PR. Besides implementing the
>std::swap bits, I figured out that the copy_code_from call did not make
>any sense, fixed the bug in the m_allocate_node call and prepared and
>tested (on x86-linux) a rather general testcase.
>
>Assuming everyone is Ok with it (Chris, in particular) I mean to commit
>it tomorrow to mainline and, after a few days, 4_0-branch too.
>  
>
...

>     protected:
>@@ -1271,8 +1271,7 @@
> 	      node** tail = m_buckets + i;
> 	      while (n)
> 		{
>-		  *tail = m_allocate_node(n);
>-		  (*tail).copy_code_from(n);
>+		  *tail = m_allocate_node(n->m_v);
> 		  tail = &((*tail)->m_next);
> 		  n = n->m_next;
> 		}
>I
>
I have a feeling the copy_code_from should possibly be:
this->copy_code(n, *tail);

It's purpose seems to be for when the hash value is cached (which I'm
not sure is ever done in any of the standard containers), and
m_allocate_node doesn't copy this value. For the specialisation where
the hashed value isn't stored in each node, this->copy_node is just
defined to be an empty function.

Chris



More information about the Libstdc++ mailing list