[PATCH] improve string find algorithm
Jonathan Wakely
jwakely@redhat.com
Fri Jan 6 21:23:00 GMT 2017
On 06/01/17 20:32 +0000, Jonathan Wakely wrote:
>On 06/01/17 13:35 +0000, Jonathan Wakely wrote:
>>I'm surprised we don't have any tests for this case, but apparently we
>>don't, as your patch passes all our tests.
>
>My bad, we do have tests that FAIL with this patch, but only after a
>'make clean' (otherwise the explicit instantiation definitions in the
>library don't get rebuilt after applying the patch, so the tests use
>the old code).
>
>FAIL: 21_strings/basic_string/operations/find/char/1.cc execution test
>FAIL: 21_strings/basic_string/operations/find/wchar_t/1.cc execution test
>
>These fail on assert(s.find(s, 1) == std::string::npos) which gives
>the wrong answer as explained in my previous mail.
>
>The infinite loop caused by this patch isn't caught by any existing
>tests, so I'll add a check for that.
Committed to trunk.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: patch.txt
Type: text/x-patch
Size: 3494 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20170106/52a2ed3c/attachment.bin>
More information about the Libstdc++
mailing list