This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug libstdc++/55911] Segfault in unordered_map with max_load_factor > 1
- From: "redi at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Wed, 09 Jan 2013 12:19:11 +0000
- Subject: [Bug libstdc++/55911] Segfault in unordered_map with max_load_factor > 1
- Auto-submitted: auto-generated
- References: <bug-55911-4@http.gcc.gnu.org/bugzilla/>
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55911
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Severity|major |normal
--- Comment #5 from Jonathan Wakely <redi at gcc dot gnu.org> 2013-01-09 12:19:11 UTC ---
When load_factor > 1 there will be more than 1 element in some buckets,
implying fewer buckets than elements, so the loop accesses non-existent
buckets.
When load_factor==1 the bucket_count() == size() so the loop succeeds (but is
still potentially wrong because the load_factor is only the *average* number of
elements per bucket.)