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++/12696] New: memory eating infinite loop in g++ 3.3.2/3.4


PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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

           Summary: memory eating infinite loop in g++ 3.3.2/3.4
           Product: gcc
           Version: 3.4
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: ctsa at u dot washington dot edu
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i386-redhat-linux
  GCC host triplet: i386-redhat-linux
GCC target triplet: i386-redhat-linux

g++ 3.3.2/3.4 correctly report the error in the example code below, but they
enter an infinite loop until physical memory is exausted. This problem does not
occur with g++ 3.2.2. 

Details:

loop.cc:
"""
struct A {
  static float b[10];
}


float A::b[] = {1,2,3};
"""

0) this is on an i386 (athlon) with a stock redhat 9.0 linux install

1) for g++ 3.2.2, a normal error is reported:
$ /usr/bin/g++ -v
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/3.2.2/specs
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man
--infodir=/usr/share/info --enable-shared --enable-threads=posix
--disable-checking --with-system-zlib --enable-__cxa_atexit --host=i386-redhat-linux
Thread model: posix
gcc version 3.2.2 20030222 (Red Hat Linux 3.2.2-5)

$ /usr/bin/g++ -c loop.cc
loop.cc:6: semicolon missing after declaration of `A'
loop.cc:6: two or more data types in declaration of `b'
loop.cc:6: conflicting types for `A A::b[]'
loop.cc:2: previous declaration as `float A::b[10]'
loop.cc:6: non-empty initializer for array of empty elements
$


2) for g++ 3.3.2, an infinite loop occurs:

$ /opt/gcc-3.3.2/bin/g++ -v
Reading specs from /opt/gcc-3.3.2/lib/gcc-lib/i686-pc-linux-gnu/3.3.2/specs
Configured with: ../gcc-3.3.2/configure --enable-languages=c,c++,f77
-enable-concept-checks --prefix=/opt/gcc-3.3.2
Thread model: posix
gcc version 3.3.2

$ /opt/gcc-3.3.2/bin/g++ -c loop.cc
loop.cc:6: error: semicolon missing after declaration of `A'
loop.cc:6: error: two or more data types in declaration of `b'
loop.cc:6: error: conflicting types for `A A::b[]'
loop.cc:2: error: previous declaration as `float A::b[10]'
loop.cc:6: error: initializer for `A' must be brace-enclosed
loop.cc:6: error: initializer for `A' must be brace-enclosed
loop.cc:6: error: initializer for `A' must be brace-enclosed
.
.
etc...


3) for a recent gcc 3.4 snapshot, the same infinite loop occurs:

$ /opt/gcc-3.4/bin/g++ -v
Reading specs from /opt/gcc-3.4/lib/gcc/i686-pc-linux-gnu/3.4/specs
Configured with: ../gcc-3.4-20031015/configure --enable-languages=c,c++,f77
--prefix=/opt/gcc-3.4 --disable-checking
Thread model: posix
gcc version 3.4 20031015 (experimental)

$ /opt/gcc-3.4/bin/g++ -c loop.cc
loop.cc:6: error: two or more data types in declaration of `b'
loop.cc:6: error: conflicting declaration 'A A::b[]'
loop.cc:2: error: 'A::b' has a previous declaration as `float A::b[10]'
loop.cc:6: error: initializer for `A' must be brace-enclosed
loop.cc:6: error: initializer for `A' must be brace-enclosed
loop.cc:6: error: initializer for `A' must be brace-enclosed
.
.
etc...


4) note that when you s/A::b[]/A::b[N]/ loop.cc, then the error is only reported
N times and the compiler exits normally.


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