public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/47290] New: memory exhausted compiling a destructor with an infinite 'for (;;);' loop
@ 2011-01-14 13:34 gcc at abeckmann dot de
  2011-01-14 14:23 ` [Bug c++/47290] [4.5/4.6 Regression] " redi at gcc dot gnu.org
                   ` (18 more replies)
  0 siblings, 19 replies; 20+ messages in thread
From: gcc at abeckmann dot de @ 2011-01-14 13:34 UTC (permalink / raw)
  To: gcc-bugs

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

           Summary: memory exhausted compiling a destructor with an
                    infinite 'for (;;);' loop
           Product: gcc
           Version: 4.6.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned@gcc.gnu.org
        ReportedBy: gcc@abeckmann.de


The following piece of code consumes all available memory when being compiled
with g++ 4.5 or g++ 4.6 and optimization level -O2 or higher. It compiles
correctly with g++ 4.4.

gcc version 4.6.0 20110111 (experimental) (GCC)
gcc version 4.5.3 20110110 (prerelease) (GCC)

===== 8< =====
struct V
{
        V ( int = 0 ) ;
        ~V ()
        {
                for ( ; ; ) ;
        }
        int size () ;
} ;
struct S
{
        V a ;
        V b ;
        S () : b ( a . size () )
        { }
} ;
S s ;
===== >8 =====

$ ulimit -v
7000000
# limited to about 7 GB ouf of my 8 GB of RAM so the machine does not start to
swap heavily

$ g++-trunk -O2 -c memhog.C
virtual memory exhausted: Cannot allocate memory

$ g++-trunk -v -O2 -c memhog.C
Using built-in specs.
COLLECT_GCC=/opt/software/x86_64/gcc-trunk/bin/g++-trunk
COLLECT_LTO_WRAPPER=/opt/software/x86_64/gcc-trunk/libexec/gcc/x86_64-unknown-linux-gnu/4.6.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc-trunk/configure --prefix=/opt/software/x86_64/gcc-trunk
--program-suffix=-trunk --enable-languages=c,c++ --enable-checking
Thread model: posix
gcc version 4.6.0 20110111 (experimental) (GCC)
COLLECT_GCC_OPTIONS='-v' '-O2' '-c' '-shared-libgcc' '-mtune=generic'
'-march=x86-64'

/opt/software/x86_64/gcc-trunk/libexec/gcc/x86_64-unknown-linux-gnu/4.6.0/cc1plus
-quiet -v -D_GNU_SOURCE memhog.C -quiet -dumpbase memhog.C -mtune=generic
-march=x86-64 -auxbase memhog -O2 -version -o /tmp/ccmZpTnX.s
GNU C++ (GCC) version 4.6.0 20110111 (experimental) (x86_64-unknown-linux-gnu)
        compiled by GNU C version 4.6.0 20110111 (experimental), GMP version
4.3.2, MPFR version 3.0.0-p3, MPC version 0.8.2
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
ignoring nonexistent directory
"/opt/software/x86_64/gcc-trunk/lib/gcc/x86_64-unknown-linux-gnu/4.6.0/../../../../x86_64-unknown-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:

/opt/software/x86_64/gcc-trunk/lib/gcc/x86_64-unknown-linux-gnu/4.6.0/../../../../include/c++/4.6.0

/opt/software/x86_64/gcc-trunk/lib/gcc/x86_64-unknown-linux-gnu/4.6.0/../../../../include/c++/4.6.0/x86_64-unknown-linux-gnu

/opt/software/x86_64/gcc-trunk/lib/gcc/x86_64-unknown-linux-gnu/4.6.0/../../../../include/c++/4.6.0/backward
 /opt/software/x86_64/gcc-trunk/lib/gcc/x86_64-unknown-linux-gnu/4.6.0/include
 /usr/local/include
 /opt/software/x86_64/gcc-trunk/include

/opt/software/x86_64/gcc-trunk/lib/gcc/x86_64-unknown-linux-gnu/4.6.0/include-fixed
 /usr/include
End of search list.
GNU C++ (GCC) version 4.6.0 20110111 (experimental) (x86_64-unknown-linux-gnu)
        compiled by GNU C version 4.6.0 20110111 (experimental), GMP version
4.3.2, MPFR version 3.0.0-p3, MPC version 0.8.2
GGC heuristics: --param ggc-min-expand=30 --param ggc-min-heapsize=4096
Compiler executable checksum: e48296e048ab4023a18c7e7537bfd602
virtual memory exhausted: Cannot allocate memory


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

end of thread, other threads:[~2011-04-18 15:28 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-14 13:34 [Bug c++/47290] New: memory exhausted compiling a destructor with an infinite 'for (;;);' loop gcc at abeckmann dot de
2011-01-14 14:23 ` [Bug c++/47290] [4.5/4.6 Regression] " redi at gcc dot gnu.org
2011-01-14 14:39 ` rguenth at gcc dot gnu.org
2011-01-17 15:47 ` [Bug tree-optimization/47290] " jakub at gcc dot gnu.org
2011-01-17 15:51 ` jakub at gcc dot gnu.org
2011-01-18 11:21 ` rguenth at gcc dot gnu.org
2011-01-18 11:30 ` rguenth at gcc dot gnu.org
2011-01-18 13:32 ` jakub at gcc dot gnu.org
2011-01-18 13:38 ` jakub at gcc dot gnu.org
2011-01-18 13:47 ` rguenth at gcc dot gnu.org
2011-01-18 14:17 ` jakub at gcc dot gnu.org
2011-01-18 14:20 ` jakub at gcc dot gnu.org
2011-01-18 17:22 ` rth at gcc dot gnu.org
2011-01-18 17:36 ` jakub at gcc dot gnu.org
2011-01-18 19:01 ` rth at gcc dot gnu.org
2011-01-18 23:22 ` jakub at gcc dot gnu.org
2011-01-18 23:32 ` [Bug tree-optimization/47290] [4.5 " jakub at gcc dot gnu.org
2011-03-08 13:26 ` rguenth at gcc dot gnu.org
2011-04-18 15:26 ` rguenth at gcc dot gnu.org
2011-04-18 15:28 ` rguenth at gcc dot gnu.org

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).