public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug libstdc++/58800] New: [4.8 regression, I think] std::nth_element segfaults on valid input
@ 2013-10-18 22:21 luto at mit dot edu
  2013-10-18 22:22 ` [Bug libstdc++/58800] " luto at mit dot edu
                   ` (27 more replies)
  0 siblings, 28 replies; 29+ messages in thread
From: luto at mit dot edu @ 2013-10-18 22:21 UTC (permalink / raw)
  To: gcc-bugs

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

            Bug ID: 58800
           Summary: [4.8 regression, I think] std::nth_element segfaults
                    on valid input
           Product: gcc
           Version: 4.8.1
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: libstdc++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: luto at mit dot edu

This program segfaults on gcc 4.8.1 from Ubuntu 13.10.  I'm building a copy of
the 4.8 branch to see if I can reproduce it there.

This is on x86_64.  I used a gross hack to specify the input so I don't have to
think about precision issues.  The numbers are all well-behaved values near
0.9.

I'll attach preprocessed source.  The preprocessed source crashes even if built
with gcc 4.7.something.

#include <algorithm>
#include <stdint.h>
//#include <iostream>

double to_double(uint64_t x)
{
        union {double d; uint64_t x;} u;
        u.x = x;
        return u.d;
}

int main()
{
        std::vector<double> v = {
                to_double(4606672070890243784),
                to_double(4606672025854247510),
                to_double(4606671800674266141),
                to_double(4606671575494284772),
                to_double(4606672115926240057),
                to_double(4606672160962236330),
                to_double(4606672070890243784),
        };

//        for (auto i : v)
//                std::cout << i << std::endl;

        std::nth_element(v.begin(), v.begin() + 3, v.end());
        return 0;
}


^ permalink raw reply	[flat|nested] 29+ messages in thread

end of thread, other threads:[~2013-12-19 16:12 UTC | newest]

Thread overview: 29+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-18 22:21 [Bug libstdc++/58800] New: [4.8 regression, I think] std::nth_element segfaults on valid input 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
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

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).