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]

Possible GCC Bug with C++ vectors


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


Attachment: ct2.cc.gz
Description: Source code


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