[PATCH] PR libstdc++/79206 check string_view sizes in operator==

Ville Voutilainen ville.voutilainen@gmail.com
Tue Jan 24 15:51:00 GMT 2017


On 24 January 2017 at 16:46, Ville Voutilainen
<ville.voutilainen@gmail.com> wrote:
> On 24 January 2017 at 16:16, Jonathan Wakely <jwakely@redhat.com> wrote:
>>> We do want it for basic_string as well, I think. And while I doubt
>>> your interpretation
>>> of the standard is pedantically correct, I also think that the
>>> standard is broken if it
>>> doesn't allow this optimization, and the standard should be fixed in that
>>> case.
>> But I think fixing this for std::basic_string should wait for stage 1.
>> The basic_string_view fix I committed only touches TS & C++17 stuff.
>
> Release-management-wise I can't disagree with postponing the
> basic_string change. However, I must
> say that an implementation that doesn't check the sizes before
> potentially comparing megabytes+10 bytes
> of data just to then say that the strings are not equal because it
> found a difference at megabytes+1
> is seriously problematic, and we should seriously entertain the idea
> of just changing it and fixing the
> standard later.

Well, ok, as established in offline discussions, this problem affects
strings that employ
custom traits or a custom allocator. The fix can wait, there's no rush as such.



More information about the Gcc-patches mailing list