This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
egcs or STL bug !?
- To: egcs-bugs at egcs dot cygnus dot com
- Subject: egcs or STL bug !?
- From: Alexander Zvyagin <zvyagin at mx dot ihep dot su>
- Date: Sat, 10 Apr 1999 12:10:06 GMT+03:00
Date: Sat, 10 Apr 1999 12:10:00 +0000
From: ZVYAGIN <ZVYAGIN@mx.ihep.su>
X-Sender: ZVYAGIN@polar.ihep.su
To: egcs-bugs@egcs.cygnus.com
Subject: egcs or STL bug !?
Message-ID: <Pine.VMS.3.91-b11-vms.990410115246.6991A-100000@polar.ihep.su>
MIME-Version: 1.0
Content-Type: TEXT/PLAIN; charset=US-ASCII
Dear egcs developers,
please, take a look at this program:
// BEGIN -------------------------------
#include <vector.h>
class B
{
public:
~B(){} // Comment the dustructor and the program will be fine...
B(){}
B(const B &b) {*this=b;}
B &operator = (const B &b) {if(this!=&b)v=b.v; return *this;}
vector<B> v;
};
main()
{
vector<B> s;
while(1)
{
s.push_back(B());
s.back().v.push_back(B());
s.pop_back();
}
}
// END --------------------------------
This program consumes memory. If you remove the destructor B::~B() the
consumption goes away... I belive there is bug in either egcs or STL.
(And I hope that code is correct - it does not require infinite memory.)
About my compiler/system:
gcc version egcs-2.91.66 19990314 (egcs-1.1.2 release)
Linux 2.0.32 i686 unknown
With best wishes,
Alexander Zvyagin.