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]

[Bug c++/13574] New: array default initializer in class lets gcc consume all memory and die


When trying to compile this program 
--- 
class A { 
  public: 
#ifdef SAFE 
    A() : argc(0) {  }; 
#else 
    A() : argc(0), argv() {  }; 
#endif 
  private: 
    int argc; 
    char* argv[]; 
}; 
 
int main() { 
    A y; 
} 
--- 
with g++ without -DSAFE, the compiler consumes all memory until it chokes: 
g++ argv.cpp -o argv -Wall 
virtual memory exhausted: Cannot allocate memory 
 
It does not happen when using "char**" as type. 
 
some info: 
 
uname -a  
Linux operator 2.4.20-4GB #1 Wed Oct 29 22:20:11 CET 2003 i686 i686 i386 
GNU/Linux 
 
g++ -v 
Reading specs from /usr/lib/gcc-lib/i586-suse-linux/3.3.1/specs 
Configured with: ../configure --enable-threads=posix --prefix=/usr 
--with-local-prefix=/usr/local --infodir=/usr/share/info 
--mandir=/usr/share/man --libdir=/usr/lib 
--enable-languages=c,c++,f77,objc,java,ada --disable-checking --enable-libgcj 
--with-gxx-include-dir=/usr/include/g++ --with-slibdir=/lib --with-system-zlib 
--enable-shared --enable-__cxa_atexit i586-suse-linux 
Thread model: posix 
gcc version 3.3.1 (SuSE Linux)

-- 
           Summary: array default initializer in class lets gcc consume all
                    memory and die
           Product: gcc
           Version: 3.3.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: pabel at iam dot uni-bonn dot de
                CC: gcc-bugs at gcc dot gnu dot org
  GCC host triplet: Linux 2.4.20-4GB i686


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=13574


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