public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/16681] New: array initialization in struct construct is a memory hog (only in gcc 3.3 and 3.4, older is fine)
@ 2004-07-23  1:10 lafary at activmedia dot com
  2004-07-23  1:11 ` [Bug c++/16681] " lafary at activmedia dot com
                   ` (20 more replies)
  0 siblings, 21 replies; 22+ messages in thread
From: lafary at activmedia dot com @ 2004-07-23  1:10 UTC (permalink / raw)
  To: gcc-bugs

This code compiles quickly and with little memory in gcc-2.95 through gcc-3.2
but in gcc-3.3 and gcc-3.4 it will take up to a gig and a half (or so) of memory
and take 2 minutes and 20 seconds to compile (vs .06 in earlier versions).

struct foo {
  unsigned char buffer[4111222];
  foo() 
    : buffer()
    {}
};

int main(void)
{

}

Here is my compiler information information (on the one system that could
compile the whole thing, also tried it with g++-2.95 g++-3.2 g++-3.3 and g++-3.4
on an up to date debian unstable machine):
[~]$ time g++ -v -save-temps -Wall foo.cpp
Reading specs from /usr/local/gcc-3.4.1/lib/gcc/i686-pc-linux-gnu/3.4.1/specs
Configured with: ../gcc-3.4.1/configure --prefix=/usr/local/gcc-3.4.1
--enable-languages=c,c++
Thread model: posix
gcc version 3.4.1
 /usr/local/gcc-3.4.1/libexec/gcc/i686-pc-linux-gnu/3.4.1/cc1plus -E -quiet -v
-D_GNU_SOURCE foo.cpp -mtune=pentiumpro -Wall -o foo.ii
ignoring nonexistent directory
"/usr/local/gcc-3.4.1/lib/gcc/i686-pc-linux-gnu/3.4.1/../../../../i686-pc-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/local/gcc-3.4.1/lib/gcc/i686-pc-linux-gnu/3.4.1/../../../../include/c++/3.4.1
 /usr/local/gcc-3.4.1/lib/gcc/i686-pc-linux-gnu/3.4.1/../../../../include/c++/3.4.1/i686-pc-linux-gnu
 /usr/local/gcc-3.4.1/lib/gcc/i686-pc-linux-gnu/3.4.1/../../../../include/c++/3.4.1/backward
 /usr/local/include
 /usr/local/gcc-3.4.1/include
 /usr/local/gcc-3.4.1/lib/gcc/i686-pc-linux-gnu/3.4.1/include
 /usr/include
End of search list.
 /usr/local/gcc-3.4.1/libexec/gcc/i686-pc-linux-gnu/3.4.1/cc1plus -fpreprocessed
foo.ii -quiet -dumpbase foo.cpp -mtune=pentiumpro -auxbase foo -Wall -version -o
foo.s
GNU C++ version 3.4.1 (i686-pc-linux-gnu)
        compiled by GNU C version 3.4.1.
GGC heuristics: --param ggc-min-expand=100 --param ggc-min-heapsize=131072
 as --traditional-format -V -Qy -o foo.o foo.s
GNU assembler version 2.11.90.0.8 (i386-redhat-linux) using BFD version 2.11.90.0.8
 /usr/local/gcc-3.4.1/libexec/gcc/i686-pc-linux-gnu/3.4.1/collect2 -m elf_i386
-dynamic-linker /lib/ld-linux.so.2 /usr/lib/crt1.o /usr/lib/crti.o
/usr/local/gcc-3.4.1/lib/gcc/i686-pc-linux-gnu/3.4.1/crtbegin.o
-L/usr/local/gcc-3.4.1/lib/gcc/i686-pc-linux-gnu/3.4.1
-L/usr/local/gcc-3.4.1/lib/gcc/i686-pc-linux-gnu/3.4.1/../../.. foo.o -lstdc++
-lm -lgcc_s -lgcc -lc -lgcc_s -lgcc
/usr/local/gcc-3.4.1/lib/gcc/i686-pc-linux-gnu/3.4.1/crtend.o /usr/lib/crtn.o

real    2m17.412s
user    2m14.220s
sys     0m3.140s

Thats a redhat 7.2 system but as I said above it happens on a debian-unstable
box too (it doesn't have enough memory to complete the compile, only 512 megs).

Here is the foo.ii:
# 1 "foo.cpp"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "foo.cpp"
struct foo {
  unsigned char buffer[4111222];
  foo()
    : buffer()
    {}
};

int main(void)
{

}

Sorry if this isn't in the right format and let me know if anymore information
is needed, I read through the guidelines, looked at the frequently reported bugs
and searched but didn't find the bug.

-- 
           Summary: array initialization in struct construct is a memory hog
                    (only in gcc 3.3 and 3.4, older is fine)
           Product: gcc
           Version: 3.4.1
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: lafary at activmedia dot com
                CC: gcc-bugs at gcc dot gnu dot org


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


^ permalink raw reply	[flat|nested] 22+ messages in thread

end of thread, other threads:[~2004-12-09 16:38 UTC | newest]

Thread overview: 22+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2004-07-23  1:10 [Bug c++/16681] New: array initialization in struct construct is a memory hog (only in gcc 3.3 and 3.4, older is fine) lafary at activmedia dot com
2004-07-23  1:11 ` [Bug c++/16681] " lafary at activmedia dot com
2004-07-23  1:13 ` lafary at activmedia dot com
2004-07-23  1:13 ` lafary at activmedia dot com
2004-07-23  1:14 ` lafary at activmedia dot com
2004-07-23  1:16 ` lafary at activmedia dot com
2004-07-23  1:26 ` [Bug c++/16681] [3.3/3.4/3.5 regression] array initialization in struct construct is a memory hog bangerth at dealii dot org
2004-08-17 15:20 ` pinskia at gcc dot gnu dot org
2004-08-18 18:37 ` mmitchel at gcc dot gnu dot org
2004-11-15  8:15 ` [Bug c++/16681] [3.3/3.4/4.0 " steven at gcc dot gnu dot org
2004-12-02 18:14 ` mmitchel at gcc dot gnu dot org
2004-12-09  9:37 ` cvs-commit at gcc dot gnu dot org
2004-12-09  9:39 ` nathan at gcc dot gnu dot org
2004-12-09 10:10 ` [Bug c++/16681] [3.3/3.4 " steven at gcc dot gnu dot org
2004-12-09 10:44 ` cvs-commit at gcc dot gnu dot org
2004-12-09 12:21 ` nathan at gcc dot gnu dot org
2004-12-09 12:22 ` cvs-commit at gcc dot gnu dot org
2004-12-09 13:59 ` cvs-commit at gcc dot gnu dot org
2004-12-09 15:10 ` cvs-commit at gcc dot gnu dot org
2004-12-09 15:10 ` nathan at gcc dot gnu dot org
2004-12-09 15:12 ` pinskia at gcc dot gnu dot org
2004-12-09 16:38 ` gdr at integrable-solutions dot net

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).