public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "chris at bubblescope dot net" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug libstdc++/58800] [4.7.4/4.8.2/4.9 Regression] std::nth_element segfaults on valid input
Date: Sat, 19 Oct 2013 11:06:00 -0000	[thread overview]
Message-ID: <bug-58800-4-p4P3PZSXDm@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-58800-4@http.gcc.gnu.org/bugzilla/>

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58800

--- Comment #18 from Chris Jefferson <chris at bubblescope dot net> ---
(In reply to Paolo Carlini from comment #13)
> Ok, note that I was reviewing the description you originally sent to the
> mailing list and it never talked about the - 2...
> 
> Let's figure out something safe, please.

I miswrote in my final paragraph:

...first+1, mid, last-1 (there is no reason in this bug to consider
last-1 instead of last, but I thought it wouldn't do any harm, and
might avoid other issues of accidentally choosing a bad pivot.

Should have said:

...first+1, mid, last-2 (there is no reason in this bug to consider *last-2*
instead of *last-1*, but I thought it wouldn't do any harm, and might avoid
other issues of accidentally choosing a bad pivot.

So, the original code chose last-1, I moved that to last-2, not checking all
the places that called the code enough (although, I could also have broken it
with the first+1 if the ranges had been small enough).

Changing 'last-2' to 'last-1' might well be the easiest, smallest fix, if it
does not effect the performance testsuite. We can then, once we have a much
more comphrehensive testsuite, make another pass at performance improvements
and tweaks.


  parent reply	other threads:[~2013-10-19 11:06 UTC|newest]

Thread overview: 29+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-10-18 22:21 [Bug libstdc++/58800] New: [4.8 regression, I think] " luto at mit dot edu
2013-10-18 22:22 ` [Bug libstdc++/58800] " luto at mit dot edu
2013-10-18 22:48 ` paolo.carlini at oracle dot com
2013-10-18 23:05 ` paolo.carlini at oracle dot com
2013-10-18 23:17 ` paolo.carlini at oracle dot com
2013-10-18 23:53 ` paolo.carlini at oracle dot com
2013-10-19  0:13 ` [Bug libstdc++/58800] [4.8.2/4.9 Regression] " luto at mit dot edu
2013-10-19  0:20 ` luto at mit dot edu
2013-10-19  0:22 ` paolo.carlini at oracle dot com
2013-10-19  0:35 ` luto at mit dot edu
2013-10-19  7:36 ` glisse at gcc dot gnu.org
2013-10-19  7:48 ` paolo.carlini at oracle dot com
2013-10-19  7:55 ` [Bug libstdc++/58800] [4.7.4/4.8.2/4.9 " chris at bubblescope dot net
2013-10-19  8:05 ` paolo.carlini at oracle dot com
2013-10-19  8:15 ` glisse at gcc dot gnu.org
2013-10-19  8:49 ` chris at bubblescope dot net
2013-10-19  8:54 ` chris at bubblescope dot net
2013-10-19 10:02 ` paolo.carlini at oracle dot com
2013-10-19 11:06 ` chris at bubblescope dot net [this message]
2013-10-19 12:11 ` chris at bubblescope dot net
2013-10-19 17:47 ` paolo.carlini at oracle dot com
2013-10-19 18:07 ` paolo.carlini at oracle dot com
2013-10-20  9:07 ` paolo at gcc dot gnu.org
2013-10-20  9:08 ` paolo at gcc dot gnu.org
2013-10-20  9:08 ` paolo at gcc dot gnu.org
2013-10-20  9:09 ` paolo.carlini at oracle dot com
2013-10-21  8:39 ` rguenth at gcc dot gnu.org
2013-11-13 15:59 ` [Bug libstdc++/58800] [4.7/4.8/4.9 " glisse at gcc dot gnu.org
2013-12-19 16:12 ` rguenth at gcc dot gnu.org

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=bug-58800-4-p4P3PZSXDm@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).