> On Mon, Jul 17, 2023 at 12:21 AM Tamar Christina via Gcc-patches <gcc- > patc...@gcc.gnu.org> wrote: > > > > > -----Original Message----- > > > From: Richard Biener <richard.guent...@gmail.com> > > > Sent: Monday, July 17, 2023 7:19 AM > > > To: Roger Sayle <ro...@nextmovesoftware.com> > > > Cc: gcc-patches@gcc.gnu.org; Tamar Christina > > > <tamar.christ...@arm.com> > > > Subject: Re: [PATCH] Fix bootstrap failure (with g++ 4.8.5) in tree-if- > conv.cc. > > > > > > On Fri, Jul 14, 2023 at 8:56 PM Roger Sayle > > > <ro...@nextmovesoftware.com> > > > wrote: > > > > > > > > > > > > > > > > This patch fixes the bootstrap failure I'm seeing using gcc 4.8.5 > > > > as > > > > > > > > the host compiler. Ok for mainline? [I might be missing > > > > something] > > > > > > OK. Btw, while I didn't spot this during review I would appreciate > > > if the code could use vec.[q]sort, this should work with a lambda as > > > well I think. > > > > That was my first use, but that hits > > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=99469 > > That is not hitting PR 99469 but rather it means your comparison is not > correct for an (unstable) sort. > That is qsort comparator should have this relationship `f(a,b) == !f(b, a)` > and > `f(a,a)` should also return false. I'm using the standard std::pair comparator which indicates that f(a,a) is true, https://en.cppreference.com/w/cpp/utility/pair/operator_cmp
> If you are running into this for qsort here, you will most likely run into > issues > with std::sort later on too. Don't see why or how. It needs to have a consistent relationship which std::pair maintains. So why would using the standard tuple comparator with a standard std::sort cause problem? Thanks, Tamar > > Thanks, > Andrew > > > > > Regards, > > Tamar