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] |
This is to report an internal compiler error while compiling a short c++ program co.cpp attached. The compiler bug (?), or rather an STL bug, is apparently related to recursive temlates handling and implementations of std::list and std::vector. Note that the code compiles and runs on egcs-1.1.2 and Borland 5.4 C++. Moreover, it compiles and runs with the STL supplied with gcc-2.95.1 replaced by the STLport version 3.2.1 (see www.stlport.org) Note that the same compiler error happens when in line 25 std::list is replaced by std::vector (and correspondign header is replaced in the 1st line, as well. The same behavour (error) happens with gcc-2.95 and with gcc-2.95.1. Attached are the source, the output of the compiler, and the preprocessor output. Hope this helps, Dmitrii. -- Dmitrii Pasechnik Dept. of Computer Science Utrecht University PO Box 80089 3508 TB Utrecht The Netherlands e-mail: dima@cs.uu.nl http://www.cs.uu.nl/staff/dima.html/ phone: +31-(0)30-2534110
#include <list> #include <iostream> static int ctr; template < template <class T> class Cont> struct Node { int index; typedef Node< Cont> Self; typedef Cont< Self*> Container; Container children; Node(const int i) : index(i), children() { ++ctr; if (i > 0) { for (int j = 0; j < 3; j++) children.push_back(new Node(i - 1)); cout << " node level " << i << endl; } } // ~Node() {} }; typedef Node<std::list> tree; int main() { ctr = 0; tree a(4); cout << " created nodes: " << ctr << endl; return 0; }
Reading specs from /usr/local/lib/gcc-lib/i586-pc-linux-gnulibc1/2.95.1/specs gcc version 2.95.1 19990816 (release) /usr/local/lib/gcc-lib/i586-pc-linux-gnulibc1/2.95.1/cpp -lang-c++ -v -D__GNUC__=2 -D__GNUG__=2 -D__GNUC_MINOR__=95 -D__cplusplus -D__ELF__ -Dunix -D__i386__ -Dlinux -D__ELF__ -D__unix__ -D__i386__ -D__linux__ -D__unix -D__linux -Asystem(posix) -D__EXCEPTIONS -Acpu(i386) -Amachine(i386) -Di386 -D__i386 -D__i386__ -Di586 -Dpentium -D__i586 -D__i586__ -D__pentium -D__pentium__ co.cpp co.ii GNU CPP version 2.95.1 19990816 (release) (i386 Linux/ELF) #include "..." search starts here: #include <...> search starts here: /usr/local/qt/include /usr/local/lib/gcc-lib/i586-pc-linux-gnulibc1/2.95.1/../../../../include/g++-3 /usr/local/include /usr/local/lib/gcc-lib/i586-pc-linux-gnulibc1/2.95.1/../../../../i586-pc-linux-gnulibc1/include /usr/local/lib/gcc-lib/i586-pc-linux-gnulibc1/2.95.1/include /usr/include End of search list. The following default directories have been omitted from the search path: End of omitted list. /usr/local/lib/gcc-lib/i586-pc-linux-gnulibc1/2.95.1/cc1plus co.ii -quiet -dumpbase co.cc -version -o co.s GNU C++ version 2.95.1 19990816 (release) (i586-pc-linux-gnulibc1) compiled by GNU C version 2.95.1 19990816 (release). /usr/local/lib/gcc-lib/i586-pc-linux-gnulibc1/2.95.1/../../../../include/g++-3/stl_list.h: In method `struct _List_node<Node<list> *> * list<Node<list> *,allocator<Node<list> *> >::_M_create_node(Node<list> *const &)': /usr/local/lib/gcc-lib/i586-pc-linux-gnulibc1/2.95.1/../../../../include/g++-3/stl_list.h:344: instantiated from `list<Node<list> *,allocator<Node<list> *> >::insert(_List_iterator<Node<list> *,Node<list> *&,Node<list> **>, Node<list> *const &)' /usr/local/lib/gcc-lib/i586-pc-linux-gnulibc1/2.95.1/../../../../include/g++-3/stl_list.h:381: instantiated from `list<Node<list> *,allocator<Node<list> *> >::push_back(Node<list> *const &)' co.cpp:16: instantiated from `Node<list>::Node(int)' co.cpp:28: instantiated from here /usr/local/lib/gcc-lib/i586-pc-linux-gnulibc1/2.95.1/../../../../include/g++-3/stl_list.h:293: Internal compiler error. /usr/local/lib/gcc-lib/i586-pc-linux-gnulibc1/2.95.1/../../../../include/g++-3/stl_list.h:293: Please submit a full bug report. /usr/local/lib/gcc-lib/i586-pc-linux-gnulibc1/2.95.1/../../../../include/g++-3/stl_list.h:293: See <URL:http://www.gnu.org/software/gcc/faq.html#bugreport> for instructions.
preprocessor output (compressed)
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |