This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: PR 57779 New debug check
- From: Jonathan Wakely <jwakely dot gcc at gmail dot com>
- To: Paolo Carlini <paolo dot carlini at oracle dot com>
- Cc: François Dumont <frs dot dumont at gmail dot com>, "libstdc++ at gcc dot gnu dot org" <libstdc++ at gcc dot gnu dot org>
- Date: Thu, 11 Jul 2013 17:58:57 +0100
- Subject: Re: PR 57779 New debug check
- References: <51DDC4A0 dot 6020008 at gmail dot com> <CAH6eHdS-X3B61M3+6NcYmiZ69Q80xda9JUMN7ciZgOC8=yZz8A at mail dot gmail dot com> <51DEE0A9 dot 9010809 at oracle dot com>
On 11 July 2013 17:43, Paolo Carlini wrote:
>>
>> + if (&(*(__it._M_get_sequence()->_M_base().end()))
>>
>> Isn't this a dereference of a non-dereferenceable iterator?
>
> Looks like this function does a very tricky work! I think that at least we
> should use __addressof and std::less, std::greater, etc to compare pointers.
> In general, we should probably try to be conservative in the first
> implementation of the check, act only when we *really* know we have
> contiguous memory, not even "blocks", like for std::deque.
The safest way would probably be to add an __is_contiguous trait,
specialized for the __gnu_debug versions of vector, array, and
dynarray, then check __is_contiguous<_Sequence>.