PR 57779 New debug check

Jonathan Wakely jwakely.gcc@gmail.com
Thu Jul 11 16:59:00 GMT 2013


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>.



More information about the Libstdc++ mailing list