This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Maybe g++ bug (in stl_algo.h 0x08048beb in std::__unguarded_partition)
On Wed, Oct 22, 2008 at 19:29, Niklaus <niklaus@gmail.com> wrote:
> yes it fails on strict weak ordering , andreas schwab too said the same.
> Why does it give Segfault. Is some optimization done with strict
> weak ordering ?
>
I don't think it's an optimization; it's just the way the logic works.
If the predicate is admissible, there's always one ordering of a and b
such that it returns false. If they're the same, your inadmissible
predicate returns true, which could quite plausibly lead to an
algorithm thinking that they're not in order and doing another
iteration, which eventually means some values go out of range.
Just like binary_search won't find anything with that predicate, etc.