Core dump with deque program
Hey all, here is the small deque program...
When this program was run for upto 529 entires it works fine. When tried for 530 entries it dumps core.
By the way instead of push_front if we use push_back, it works fine. However, we are facing this problem with Sun ONE Studio 11 after our successful compiler upgrade.
If any one has any idea why the following program dumping core with 530 entires?
cut and paste and compile and run ./deque 530, you will receive a core dump in Solaris 10/Sun one Studio 11 (CC 5.8 compiler). Important: make sure you run Solaris 10/Sun One Studio 11 CC 5.8 compiler compiled code.
IT IS NOT DUMPING CORE IN OLDER VERSIONS....
==========deque.cc===================
#include <deque>
#include <iostream>
int main( int argc, char* argv[] )
{
std::deque< int > container;
std::cout << "maxSize:" << container.max_size() << "\n";
int last( 530 );
if ( argc > 1 )
{
last = atoi( argv[ argc - 1 ] );
}
std::cout << "Building to " << last << "\n";
for ( int i = 0; i < last; ++ i )
{
container.push_front( i );
}
int idx = 0;
for ( std::deque< int >::const_iterator
iter = container.begin();
iter != container.end();
++ iter, ++ idx )
{
std::cout << idx << ": " << (*iter) << "\n";
}
std::cout << "maxSize:" << container.max_size() << "\n";
return 0;
}
The pstack output from core file...
core 'core.deque' of 3869:./deque 530
00011a40 main(2, ffbfd7ec, ffbfd758, ffbfd768, ffbfd768, ffbfd630) + 2b8
00011358 _start(0, 0, 0, 0, 0, 0) + 108

