[Bug libstdc++/47921] pbump will overflow when input n is larger than 2G-1
RobertPython at 163 dot com
gcc-bugzilla@gcc.gnu.org
Mon Feb 28 11:14:00 GMT 2011
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=47921
--- Comment #1 from Robert Python <RobertPython at 163 dot com> 2011-02-28 10:51:30 UTC ---
try below program in a 64bit environment with about 8G memory:
#include <string>
#include <strstream>
#include <iostream>
#define N 100000000
#define SIZE 40
using namespace std;
int main()
{
const char msg[SIZE] = "aaaaaaaaaaaaaaaaaaaaaaaaaaa";
strstreambuf *new_data = new strstreambuf();
for (int i = 0; i < N; ++i)
{
new_data->freeze(false);
new_data->sputn(msg, SIZE);
}
delete new_data;
return 0;
}
More information about the Gcc-bugs
mailing list