From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 20844 invoked by alias); 4 Mar 2012 16:11:03 -0000 Received: (qmail 20823 invoked by uid 22791); 4 Mar 2012 16:10:59 -0000 X-SWARE-Spam-Status: No, hits=-2.8 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 04 Mar 2012 16:10:26 +0000 From: "daniel.kruegler at googlemail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/52476] [C++11] Unordered multimap reorders equivalent elements Date: Sun, 04 Mar 2012 16:11:00 -0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libstdc++ X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: daniel.kruegler at googlemail dot com X-Bugzilla-Status: NEW X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2012-03/txt/msg00346.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D52476 --- Comment #2 from Daniel Kr=C3=BCgler 2012-03-04 16:10:19 UTC --- (In reply to comment #1) > (we should double check that by avoiding any use of > fancy C++11 features like initializer lists in the testcase) I rewrote the testcase in C++03 form and based on TR1 unordered map: //------ #include #include #include typedef std::tr1::unordered_multimap map_type; void printHashTable(const map_type& map) { for (unsigned i =3D 0; i < map.bucket_count(); ++i) { std::cout << "b[" << i << "]:" << std::endl; for (map_type::const_local_iterator it =3D map.begin(i); it !=3D map.en= d(i); ++it) { std::cout << " " << map.hash_function()(it->first) << " [" << it->first << "," << it->second << "]" << std::endl; } } std::cout << "----------------------" << std::endl; } int main() { typedef std::pair P; const P input1[] =3D { P(0,0), P(1,0), P(2,0), P(3,0), P(4,0), P(1,1) }; map_type dict(input1, input1 + sizeof(input1)/sizeof(input1[0])); printHashTable(dict); const P input2[] =3D { P(3,1), P(3,2), P(5,0) }; dict.insert(input2, input2 + sizeof(input2)/sizeof(input2[0])); printHashTable(dict); dict.max_load_factor(0.5); printHashTable(dict); } //------ The incorrect runtime behaviour is unchanged compared to the original form. This means, one could actually remove the [C++11] tag from the bug title.