This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
serious bug in libstdc++-3.2 std::copy?
- From: nbecker at hns dot com (Neal D. Becker)
- To: gcc at gcc dot gnu dot org
- Date: 04 Dec 2002 11:25:52 -0500
- Subject: serious bug in libstdc++-3.2 std::copy?
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:
1.
template<typename _InputIter, typename _OutputIter>
inline _OutputIter
copy(_InputIter __first, _InputIter __last, _OutputIter __result)
OK so far.
2. template<typename _InputIter, typename _OutputIter>
inline _OutputIter
__copy_ni1(_InputIter __first, _InputIter __last,
_OutputIter __result, __false_type)
OK, input is not normal.
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)
5. template<typename _Tp>
inline _Tp*
__copy_trivial(const _Tp* __first, const _Tp* __last, _Tp*
__result)
Wrong! This calls memmove. But the input iterator doesn't have
pointer-type semantics.
Am I misunderstanding something, or is there a serious bug here?