Bug 1031495 - gcc-c++ std::nth_element segfaults on valid input
Summary: gcc-c++ std::nth_element segfaults on valid input
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: gcc
Version: 19
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Jakub Jelinek
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-11-18 06:13 UTC by Ben Webb
Modified: 2014-01-15 23:52 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-01-15 23:52:19 UTC
Type: Bug


Attachments (Terms of Use)


Links
System ID Private Priority Status Summary Last Updated
GNU Compiler Collection 58800 0 None None None Never

Description Ben Webb 2013-11-18 06:13:56 UTC
Description of problem:

A valid c++ program like this segfaults:

#include <algorithm>

int main() {
 double mm[] = {2, 2, 3, 2};
 size_t ms = sizeof(mm) / sizeof(double);
 std::nth_element(mm, mm+1, mm+ms);
}

because nth_element is broken

The bug has been reported and fixed upstream
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=58800

The same problem affects Fedora 20 and has been reported there as bug #1029217.

Comment 1 Laurent Rineau 2013-11-27 09:30:56 UTC
A lot of components of the Computational Geometry Algorithms Library (www.cgal.org) segfault because of that bug. The package CGAL-devel-4.2-1.fc19 is impacted.

Ubuntu has released a patched version:
https://bugs.launchpad.net/ubuntu/+source/gcc-4.8/+bug/1246802

I do not know about other Linux distributions, so far.

Comment 2 Laurent Rineau 2013-12-20 09:35:32 UTC
Seems fixed in libstdc++-devel-4.8.2-7.fc19


Note You need to log in before you can comment on or make changes to this bug.