This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: serious bug in libstdc++-3.2 std::copy?
>>>>> "Phil" == Phil Edwards <phil@jaj.com> writes:
Phil> 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:
Phil> [...]
>>
>> 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)
Phil> If the input iterator does not have pointer-type semantics, then this
Phil> is where things have gone wrong. The first/last parameters are already
Phil> assumed to be Tp*'s here.
Phil> #3 -> #4 could only happen the way you show here if both the input iterators
Phil> and the (underlying) output iterator can all de deduced to be pointing to
Phil> the same type. Are RingBuffer's iterators pointer types?
No, they are not pointers.
I'm having trouble reproducing the problem now. I'll let you know if
I can get a test case going.