Possible GCC Bug with C++ vectors

Stephan Trebs stacit@freenet.de
Thu Apr 3 14:36:00 GMT 2003


Hello!

I want to report a possible gcc bug. I hope it is really a bug and not my mistake.

System  : Athlon 1333, 512 MB RAM, Linux 2.4.18 (Debian Woody)
Compiler: GCC 3.2.1 (compiled with 2.95.4 and options "-O2")
Program : C++ using <vector>

The concerning sources are attached. It is a program with 7000 lines but
no complicated stuff. Only one function and some vectors. Without flags
it compiles within eight seconds. But if I use "-O" the compiler (cc1plus)
needs slowly more and more memory and has possibly entered an invinite loop.
After 30 minutes it needs 193 MB RAM and is still working. I tried it
several times for up to 30 minutes before canceling the compiler.
GCC 2.95.4 works and needs with "-O" rather long 70 seconds to compile the
program.

The problem seems to be in my function init(). Because a plain init(){}
works. But I couldn't find details, because this small program works:

---------------------------------------
include <cstdlib>
include <vector>

using namespace std;

int
main ()
{
  vector<vector <vector<int> > >v;
  
  v.resize(10);
  v[0].resize(10);
  v[0][0].resize(100);
  v[0][0][0]=5;

  return EXIT_SUCCESS;
}
---------------------------------------

And init() contains only such commands.

So I attached the big function init() as it is and gziped it.
GCC 3.0.4 seems also not to work.


I hope this description helps you.


Thanks,
	Stephan Trebs


-------------- next part --------------
A non-text attachment was scrubbed...
Name: ct2.cc.gz
Type: application/x-gzip
Size: 32755 bytes
Desc: Source code
URL: <http://gcc.gnu.org/pipermail/gcc-bugs/attachments/20030403/082eaeac/attachment.bin>


More information about the Gcc-bugs mailing list