[PATCH] improve string find algorithm

Jonathan Wakely jwakely@redhat.com
Fri Jan 6 20:32:00 GMT 2017


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.



More information about the Libstdc++ mailing list