This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libstdc++/55911] Segfault in unordered_map with max_load_factor > 1


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]