serious bug in libstdc++-3.2 std::copy?

Phil Edwards phil@jaj.com
Wed Dec 4 08:49:00 GMT 2002


On Wed, Dec 04, 2002 at 11:25:52AM -0500, Neal D. Becker wrote:
> I am copying from a custom container (RingBuffer) to a vector.  The
> RingBuffer has a special iterator.  I use std::copy.  I get a
> segfault.  GDB tells me:
[...]
> 
> 3. inline _OutputIter
>     __copy_ni2(_InputIter __first, _InputIter __last,
> 	       _OutputIter __result, __true_type)
> 
> OK, output is normal
> 
> 4. template<typename _Tp>
>     inline _Tp*
>     __copy_aux2(_Tp* __first, _Tp* __last,
> 		_Tp* __result, __true_type)
> 
> OK, type has trivial assign (in this case it is int)

If the input iterator does not have pointer-type semantics, then this
is where things have gone wrong.  The first/last parameters are already
assumed to be Tp*'s here.

#3 -> #4 could only happen the way you show here if both the input iterators
and the (underlying) output iterator can all de deduced to be pointing to
the same type.  Are RingBuffer's iterators pointer types?


Phil

-- 
I would therefore like to posit that computing's central challenge, viz. "How
not to make a mess of it," has /not/ been met.
                                                 - Edsger Dijkstra, 1930-2002



More information about the Gcc mailing list