public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Biener <richard.guenther@gmail.com>
To: Tamar Christina <Tamar.Christina@arm.com>,
	Alexander Monakov <amonakov@ispras.ru>
Cc: Andrew Pinski <pinskia@gmail.com>,
	Roger Sayle <roger@nextmovesoftware.com>,
	 "gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] Fix bootstrap failure (with g++ 4.8.5) in tree-if-conv.cc.
Date: Mon, 17 Jul 2023 14:00:10 +0200	[thread overview]
Message-ID: <CAFiYyc1zn228PHeOY7kknNMEMuMEhWk50B8MBRYjPaPs-L5T9A@mail.gmail.com> (raw)
In-Reply-To: <VI1PR08MB53256AC968F36484E1B6082BFF3BA@VI1PR08MB5325.eurprd08.prod.outlook.com>

On Mon, Jul 17, 2023 at 9:35 AM Tamar Christina <Tamar.Christina@arm.com> wrote:
>
> > On Mon, Jul 17, 2023 at 12:21 AM Tamar Christina via Gcc-patches <gcc-
> > patches@gcc.gnu.org> wrote:
> > >
> > > > -----Original Message-----
> > > > From: Richard Biener <richard.guenther@gmail.com>
> > > > Sent: Monday, July 17, 2023 7:19 AM
> > > > To: Roger Sayle <roger@nextmovesoftware.com>
> > > > Cc: gcc-patches@gcc.gnu.org; Tamar Christina
> > > > <Tamar.Christina@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
> > > > <roger@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?

At least for

     return left.second < right.second;

f(a,a) doesn't hold.  Note qsort can end up comparing an element to
itself (not sure
if GCCs implementation now can).

Richard.

> Thanks,
> Tamar
>
> >
> > Thanks,
> > Andrew
> >
> > >
> > > Regards,
> > > Tamar

  reply	other threads:[~2023-07-17 12:00 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-14 18:56 Roger Sayle
2023-07-14 19:15 ` Andrew Pinski
2023-07-17  6:19 ` Richard Biener
2023-07-17  7:19   ` Tamar Christina
2023-07-17  7:27     ` Andrew Pinski
2023-07-17  7:35       ` Tamar Christina
2023-07-17 12:00         ` Richard Biener [this message]
2023-07-17 13:48           ` Alexander Monakov

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAFiYyc1zn228PHeOY7kknNMEMuMEhWk50B8MBRYjPaPs-L5T9A@mail.gmail.com \
    --to=richard.guenther@gmail.com \
    --cc=Tamar.Christina@arm.com \
    --cc=amonakov@ispras.ru \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=pinskia@gmail.com \
    --cc=roger@nextmovesoftware.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).