libstdc++/8195: n-th algorithm (STL) doesn`t work properly

johnb@stl.sarov.ru johnb@stl.sarov.ru
Fri Oct 11 04:16:00 GMT 2002


>Number:         8195
>Category:       libstdc++
>Synopsis:       n-th algorithm (STL) doesn`t work properly
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Fri Oct 11 04:16:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     johnb@stl.sarov.ru (Eugeny Belov)
>Release:        g++ v3.2
>Organization:
>Environment:
Red Hat Linux release 8.0
>Description:
The simple testcase using nth_element() doesn`t work properly. Compiled by g++ (v.3.2, 3.1, 2.96) it gives the "4 4 5 6 6 6 9 12 8 10", but expected output is "4 4 5 6 6 6 8 9 10 12" (sorted sequence). See the testcase.
>How-To-Repeat:
Compile the testcase by g++ and run it, compare output. The correct result is the sorted integers sequence.
>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: application/octet-stream; name="nth-elem.cpp"
Content-Transfer-Encoding: base64
Content-Disposition: attachment; filename="nth-elem.cpp"

I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8YWxnb3JpdGhtPgojaW5jbHVkZSA8aXRlcmF0
b3I+Cgp1c2luZyBuYW1lc3BhY2Ugc3RkOwoKaW50IG1haW4oKQp7ICAKICAgaW50IGFbMTBdID0g
ezQsIDEyLCA5LCA1LCA2LCA2LCA2LCA0LCA4LCAxMH07CiAgIAogICAgbnRoX2VsZW1lbnQoYSwg
YSsyLCBhKzEwKTsKICAgIGNvcHkoYSwgYSsxMCwgb3N0cmVhbV9pdGVyYXRvcjxpbnQ+KGNvdXQs
ICIgIikpOwogICAgY291dCA8PCBlbmRsOwoKICAgcmV0dXJuIDA7Cn0K



More information about the Gcc-bugs mailing list