This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PR 57779 New debug check


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]