https://gcc.gnu.org/bugzilla/show_bug.cgi?id=70794
Bug ID: 70794 Summary: vector.push_back() crashes with std::bad_alloc after 2^32 calls Product: gcc Version: 5.3.1 Status: UNCONFIRMED Severity: minor Priority: P3 Component: libstdc++ Assignee: unassigned at gcc dot gnu.org Reporter: numien at deathwyrm dot com Target Milestone: --- Created attachment 38340 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=38340&action=edit Minimal test program Despite std::vector::max_size() returning 18446744073709551615, a test program to repeatedly call std::vector::push_back() crashes on the 4294967297th iteration with a std::bad_alloc exception. I am compiling in 64-bit mode, and my system should have plenty of memory. The fact it's reaching exactly 2^32 indicates to me that it's likely a bug. The test program I used is attached.