Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: "Christian Biesinger (Code Review)" <gerrit@gnutoolchain-gerrit.osci.io>
To: Christian Biesinger <cbiesinger@google.com>,	gdb-patches@sourceware.org
Cc: Tom Tromey <tromey@sourceware.org>,
	Simon Marchi <simon.marchi@polymtl.ca>
Subject: [review v3] Replace some more qsort calls with std::sort
Date: Mon, 21 Oct 2019 16:22:00 -0000	[thread overview]
Message-ID: <20191021162247.26ECD21926@gnutoolchain-gerrit.osci.io> (raw)
In-Reply-To: <gerrit.1571352182000.Ibcddce12a3d07448701e731b7150fa23611d86de@gnutoolchain-gerrit.osci.io>

Christian Biesinger has posted comments on this change.

Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/131
......................................................................


Patch Set 3:

> Patch Set 3:
> 
> It looks like this patch causes some regressions when building with -D_GLIBCXX_DEBUG=1.  One such failure is in gdb.dwarf2/ada-linkage-name.exp (make check TESTS="gdb.dwarf2/ada-linkage-name.exp").
> 
> The problem is that the comparison functions don't have the required properties for std::sort:
> 
>  49 /usr/include/c++/9.2.0/bits/stl_algo.h:4858:^M
>  50 In function:^M
>  51     void std::sort(_RAIter, _RAIter, _Compare) [with _RAIter = ^M
>  52     obj_section**; _Compare = bool (*)(const obj_section*, const ^M
>  53     obj_section*)]^M
>  54 ^M
>  55 Error: comparison doesn't meet irreflexive requirements, assert(!(a < a)).^M
>  56 ^M
>  57 Objects involved in the operation:^M
>  58     instance "functor" @ 0x0x7ffda9ccc9a0 {^M
>  59       type = bool (*)(obj_section const*, obj_section const*);^M
>  60     }^M
>  61     iterator::value_type "ordered type" {^M
>  62       type = obj_section*;^M
>  63     }^M
> 
> It is probably a pre-existing bad behavior with the comparison functions, but using std::sort points those out.
> 
> I would encourage you to use -D_GLIBCXX_DEBUG=1 all the time for your development builds (except for when you want to do benchmarks), it catches a bunch of things.

Thanks for finding this! I will make sure to use that define. Meanwhile aburgess uploaded a patch to fix this: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/177



      parent reply	other threads:[~2019-10-21 16:22 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-17 22:43 [review] " Christian Biesinger (Code Review)
2019-10-18 13:47 ` Tom Tromey (Code Review)
2019-10-18 21:40 ` Christian Biesinger (Code Review)
2019-10-18 21:41 ` Christian Biesinger (Code Review)
2019-10-19  4:32 ` Simon Marchi (Code Review)
2019-10-19 20:43 ` [review v2] " Tom Tromey (Code Review)
2019-10-19 20:47 ` [pushed] " Sourceware to Gerrit sync (Code Review)
2019-10-19 20:47 ` Sourceware to Gerrit sync (Code Review)
2019-10-21  4:45 ` [review v3] " Simon Marchi (Code Review)
2019-10-21 16:22 ` Christian Biesinger (Code Review) [this message]

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=20191021162247.26ECD21926@gnutoolchain-gerrit.osci.io \
    --to=gerrit@gnutoolchain-gerrit.osci.io \
    --cc=cbiesinger@google.com \
    --cc=gdb-patches@sourceware.org \
    --cc=simon.marchi@polymtl.ca \
    --cc=tromey@sourceware.org \
    /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