I had tried to compile code like

template<int dim> class cls {
     cls<dim-1> c[16];
};
template<> class cls<0> {
};

int main() {
     cls<200> c;
     return 0;
}

and had error:

g++: Internal error: Segmentation fault (program cc1plus)
Please submit a full bug report.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.

I think, in this case better output maybe something like "no enough memory",
"unable to compile" etc.



Information as defined in http://gcc.gnu.org/bugs.html

- the options given when GCC was configured/built

--prefix=/usr --libexecdir=/usr/lib --enable-shared --enable-threads=posix
--enable-__cxa_atexit --enable-clocale=gnu --enable-languages=c,c++



- the complete command line that triggers the bug

g++ bug.cpp


- the compiler output (error messages, warnings, etc.)

g++: Internal error: Segmentation fault (program cc1plus)
Please submit a full bug report.
See <URL:http://gcc.gnu.org/bugs.html> for instructions.


- the preprocessed file (*.i*) that triggers the bug, generated by adding
-save-temps to the complete compilation command, or, in the case of a bug
report for the GNAT front end, a complete set of source files (see below)

Reading specs from /usr/lib/gcc/i686-pc-linux-gnu/3.4.3/specs
Configured with: ../gcc-3.4.3/configure --prefix=/usr --libexecdir=/usr/lib
--enable-shared --enable-threads=posix --enable-__cxa_atexit
--enable-clocale=gnu --enable-languages=c,c++
Thread model: posix
gcc version 3.4.3
 /usr/lib/gcc/i686-pc-linux-gnu/3.4.3/cc1plus -E -quiet -v -D_GNU_SOURCE
bug.cpp -mtune=pentiumpro
ignoring nonexistent directory
"/usr/lib/gcc/i686-pc-linux-gnu/3.4.3/../../../../i686-pc-linux-gnu/include"
#include "..." search starts here:
#include <...> search starts here:
 /usr/lib/gcc/i686-pc-linux-gnu/3.4.3/../../../../include/c++/3.4.3

/usr/lib/gcc/i686-pc-linux-gnu/3.4.3/../../../../include/c++/3.4.3/i686-pc-linux-gnu
 /usr/lib/gcc/i686-pc-linux-gnu/3.4.3/../../../../include/c++/3.4.3/backward
 /usr/local/include
 /usr/lib/gcc/i686-pc-linux-gnu/3.4.3/include
 /usr/include
End of search list.
# 1 "bug.cpp"
# 1 "<built-in>"
# 1 "<command line>"
# 1 "bug.cpp"
template<int dim> class cls {
     cls<dim-1> c[16];
};
template<> class cls<0> {
};


int main() {
     cls<200> c;
     return 0;
}


-- 
           Summary: recursive templates compilation fault
           Product: gcc
           Version: 3.4.3
            Status: UNCONFIRMED
          Severity: minor
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: generatorglukoff at gmail dot com
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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

Reply via email to