This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/58358] [4.7/4.8/4.9 Regression] search_n has a Complexity violation for random access iterator
- From: "kariya_mitsuru at hotmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 09 Sep 2013 16:56:47 +0000
- Subject: [Bug libstdc++/58358] [4.7/4.8/4.9 Regression] search_n has a Complexity violation for random access iterator
- Auto-submitted: auto-generated
- References: <bug-58358-4 at http dot gcc dot gnu dot org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58358
--- Comment #15 from Mitsuru Kariya <kariya_mitsuru at hotmail dot com> ---
Created attachment 30775
--> http://gcc.gnu.org/bugzilla/attachment.cgi?id=30775&action=edit
Patch
For your convenience, I attached a patch for this problem.
This algorithm is always scanned to reverse order.
If a scan fails in less than enough, a re-scan is performed from the point that
advanced necessary elements from the original starting point.
For example, if __count is 20 and a scan fails after 18 elements succeeded, a
re-scan is performed from the point that advanced 2 elements.