I don' really know whether this is a real gcc error or gcc is only less error tolerant. Compiling gcc -DHAVE_CONFIG_H -c caddnewtranslationdlg.ii I get: (I give only beginning!) In file included from /usr/lib/qt/include/qvaluelist.h:405, from /usr/lib/qt/include/qvaluelist.h:405, from /usr/lib/qt/include/qvaluelist.h:405, from /usr/lib/qt/include/qvaluelist.h:405, from /usr/lib/qt/include/qvaluelist.h:405, from /usr/lib/qt/include/qvaluelist.h:405, from /usr/lib/qt/include/qvaluelist.h:405, from /usr/lib/qt/include/qvaluelist.h:405, from /usr/lib/qt/include/qvaluelist.h:405, from /usr/lib/qt/include/qvaluelist.h:405, from /usr/lib/qt/include/qvaluelist.h:405, from /usr/lib/qt/include/qvaluelist.h:405, from /usr/lib/qt/include/qvaluelist.h:405, from /usr/lib/qt/include/qvaluelist.h:405, from /usr/lib/qt/include/qvaluelist.h:405, from /usr/lib/qt/include/qvaluelist.h:405, from /usr/lib/qt/include/qvaluelist.h:405, from /usr/lib/qt/include/qvaluelist.h:405, from /usr/lib/qt/include/qvaluelist.h:405, from /usr/lib/qt/include/qvaluelist.h:405, from /usr/lib/qt/include/qvaluelist.h:405, from /usr/lib/qt/include/qvaluelist.h:405, from /usr/lib/qt/include/qvaluelist.h:405, from /usr/lib/qt/include/qvaluelist.h:405, from /usr/lib/qt/include/qvaluelist.h:405, from /usr/lib/qt/include/qvaluelist.h:405, from /usr/lib/qt/include/qvaluelist.h:405, from /usr/lib/qt/include/qvaluelist.h:405, from /usr/lib/qt/include/qvaluelist.h:405, from /usr/lib/qt/include/qvaluelist.h:405, from /usr/lib/qt/include/qvaluelist.h:405, from /usr/lib/qt/include/qvaluelist.h:405, from /usr/lib/qt/include/qvaluelist.h:405, from /usr/lib/qt/include/qvaluelist.h:405, from /usr/lib/qt/include/qvaluelist.h:405, from /usr/lib/qt/include/qvaluelist.h:405, from /usr/lib/qt/include/qvaluelist.h:405, from /usr/lib/qt/include/qvaluelist.h:405, from /usr/lib/qt/include/qvaluelist.h:405, from /usr/lib/qt/include/qvaluelist.h:405, from /usr/lib/qt/include/qvaluelist.h:405, from /usr/lib/qt/include/qvaluelist.h:405, from /usr/lib/qt/include/qvaluelist.h:405, from /usr/lib/qt/include/qvaluelist.h:405, from /usr/lib/qt/include/qvaluelist.h:405, from /usr/lib/qt/include/qvaluelist.h:405, from /usr/lib/qt/include/qvaluelist.h:405, from /usr/lib/qt/include/qvaluelist.h:405, from /usr/lib/qt/include/qvaluelist.h:405, from caddnewtranslationdlg.cpp:77: /usr/lib/qt/include/qvaluelist.h: In member function `QValueList<T>& QValueList<T>::operator<<(const T&) [with T = QString]': /usr/lib/qt/include/qvaluelist.h:405: template instantiation depth exceeds maximum of 50 (use -ftemplate-depth-NN to increase the maximum) instantiating `QValueList<T>& QValueList<T>::operator<<(const T&) [with T = QString]' /usr/lib/qt/include/qvaluelist.h:405: instantiated from `QValueList<T>& QValueList<T>::operator<<(const T&) [with T = QString]' /usr/lib/qt/include/qvaluelist.h:405: instantiated from `QValueList<T>& QValueList<T>::operator<<(const T&) [with T = QString]' /usr/lib/qt/include/qvaluelist.h:405: instantiated from `QValueList<T>& QValueList<T>::operator<<(const T&) [with T = QString]' /usr/lib/qt/include/qvaluelist.h:405: instantiated from `QValueList<T>& QValueList<T>::operator<<(const T&) [with T = QString]' /usr/lib/qt/include/qvaluelist.h:405: instantiated from `QValueList<T>& QValueList<T>::operator<<(const T&) [with T = QString]' /usr/lib/qt/include/qvaluelist.h:405: instantiated from `QValueList<T>& QValueList<T>::operator<<(const T&) [with T = QString]' /usr/lib/qt/include/qvaluelist.h:405: instantiated from `QValueList<T>& QValueList<T>::operator<<(const T&) [with T = QString]' /usr/lib/qt/include/qvaluelist.h:405: instantiated from `QValueList<T>& QValueList<T>::operator<<(const T&) [with T = QString]' /usr/lib/qt/include/qvaluelist.h:405: instantiated from `QValueList<T>& QValueList<T>::operator<<(const T&) [with T = QString]' /usr/lib/qt/include/qvaluelist.h:405: instantiated from `QValueList<T>& QValueList<T>::operator<<(const T&) [with T = QString]' /usr/lib/qt/include/qvaluelist.h:405: instantiated from `QValueList<T>& QValueList<T>::operator<<(const T&) [with T = QString]' /usr/lib/qt/include/qvaluelist.h:405: instantiated from `QValueList<T>& QValueList<T>::operator<<(const T&) [with T = QString]' /usr/lib/qt/include/qvaluelist.h:405: instantiated from `QValueList<T>& QValueList<T>::operator<<(const T&) [with T = QString]' /usr/lib/qt/include/qvaluelist.h:405: instantiated from `QValueList<T>& QValueList<T>::operator<<(const T&) [with T = QString]' /usr/lib/qt/include/qvaluelist.h:405: instantiated from `QValueList<T>& QValueList<T>::operator<<(const T&) [with T = QString]' /usr/lib/qt/include/qvaluelist.h:405: instantiated from `QValueList<T>& QValueList<T>::operator<<(const T&) [with T = QString]' /usr/lib/qt/include/qvaluelist.h:405: instantiated from `QValueList<T>& QValueList<T>::operator<<(const T&) [with T = QString]' /usr/lib/qt/include/qvaluelist.h:405: instantiated from `QValueList<T>& QValueList<T>::operator<<(const T&) [with T = QString]' /usr/lib/qt/include/qvaluelist.h:405: instantiated from `QValueList<T>& QValueList<T>::operator<<(const T&) [with T = QString]' /usr/lib/qt/include/qvaluelist.h:405: instantiated from `QValueList<T>& QValueList<T>::operator<<(const T&) [with T = QString]' /usr/lib/qt/include/qvaluelist.h:405: instantiated from `QValueList<T>& QValueList<T>::operator<<(const T&) [with T = QString]' /usr/lib/qt/include/qvaluelist.h:405: instantiated from `QValueList<T>& QValueList<T>::operator<<(const T&) [with T = QString]' /usr/lib/qt/include/qvaluelist.h:405: instantiated from `QValueList<T>& QValueList<T>::operator<<(const T&) [with T = QString]' /usr/lib/qt/include/qvaluelist.h:405: instantiated from `QValueList<T>& QValueList<T>::operator<<(const T&) [with T = QString]' /usr/lib/qt/include/qvaluelist.h:405: instantiated from `QValueList<T>& QValueList<T>::operator<<(const T&) [with T = QString]' /usr/lib/qt/include/qvaluelist.h:405: instantiated from `QValueList<T>& QValueList<T>::operator<<(const T&) [with T = QString]' /usr/lib/qt/include/qvaluelist.h:405: instantiated from `QValueList<T>& QValueList<T>::operator<<(const T&) [with T = QString]' /usr/lib/qt/include/qvaluelist.h:405: instantiated from `QValueList<T>& QValueList<T>::operator<<(const T&) [with T = QString]' /usr/lib/qt/include/qvaluelist.h:405: instantiated from `QValueList<T>& QValueList<T>::operator<<(const T&) [with T = QString]' /usr/lib/qt/include/qvaluelist.h:405: instantiated from `QValueList<T>& QValueList<T>::operator<<(const T&) [with T = QString]' /usr/lib/qt/include/qvaluelist.h:405: instantiated from `QValueList<T>& QValueList<T>::operator<<(const T&) [with T = QString]' /usr/lib/qt/include/qvaluelist.h:405: instantiated from `QValueList<T>& QValueList<T>::operator<<(const T&) [with T = QString]' /usr/lib/qt/include/qvaluelist.h:405: instantiated from `QValueList<T>& QValueList<T>::operator<<(const T&) [with T = QString]' /usr/lib/qt/include/qvaluelist.h:405: instantiated from `QValueList<T>& QValueList<T>::operator<<(const T&) [with T = QString]' /usr/lib/qt/include/qvaluelist.h:405: instantiated from `QValueList<T>& QValueList<T>::operator<<(const T&) [with T = QString]' /usr/lib/qt/include/qvaluelist.h:405: instantiated from `QValueList<T>& QValueList<T>::operator<<(const T&) [with T = QString]' /usr/lib/qt/include/qvaluelist.h:405: instantiated from `QValueList<T>& QValueList<T>::operator<<(const T&) [with T = QString]' /usr/lib/qt/include/qvaluelist.h:405: instantiated from `QValueList<T>& QValueList<T>::operator<<(const T&) [with T = QString]' /usr/lib/qt/include/qvaluelist.h:405: instantiated from `QValueList<T>& QValueList<T>::operator<<(const T&) [with T = QString]' /usr/lib/qt/include/qvaluelist.h:405: instantiated from `QValueList<T>& QValueList<T>::operator<<(const T&) [with T = QString]' /usr/lib/qt/include/qvaluelist.h:405: instantiated from `QValueList<T>& QValueList<T>::operator<<(const T&) [with T = QString]' /usr/lib/qt/include/qvaluelist.h:405: instantiated from `QValueList<T>& QValueList<T>::operator<<(const T&) [with T = QString]' /usr/lib/qt/include/qvaluelist.h:405: instantiated from `QValueList<T>& QValueList<T>::operator<<(const T&) [with T = QString]' /usr/lib/qt/include/qvaluelist.h:405: instantiated from `QValueList<T>& QValueList<T>::operator<<(const T&) [with T = QString]' /usr/lib/qt/include/qvaluelist.h:405: instantiated from `QValueList<T>& QValueList<T>::operator<<(const T&) [with T = QString]' /usr/lib/qt/include/qvaluelist.h:405: instantiated from `QValueList<T>& QValueList<T>::operator<<(const T&) [with T = QString]' /usr/lib/qt/include/qvaluelist.h:405: instantiated from `QValueList<T>& QValueList<T>::operator<<(const T&) [with T = QString]' /usr/lib/qt/include/qvaluelist.h:405: instantiated from `QValueList<T>& QValueList<T>::operator<<(const T&) [with T = QString]' /usr/lib/qt/include/qvaluelist.h:405: instantiated from `QValueList<T>& QValueList<T>::operator<<(const T&) [with T = QString]' /usr/lib/qt/include/qvaluelist.h:405: instantiated from `QValueList<T>& QValueList<T>::operator<<(const T&) [with T = QString]' caddnewtranslationdlg.cpp:77: instantiated from here /usr/lib/qt/include/qvaluelist.h:405: template instantiation depth exceeds maximum of 50 (use -ftemplate-depth-NN to increase the maximum) instantiating `QValueList<T>& QValueList<T>::operator<<(const T&) [with T = QString]' With GCC 3.0.1 works! Release: latest cvs Environment: glibc-2.2.90 How-To-Repeat: gcc -DHAVE_CONFIG_H -c caddnewtranslationdlg.ii
Fix: ????
State-Changed-From-To: open->analyzed State-Changed-Why: Reproduced in latest CVS. Works with no problem with gcc 3.0.3. If in gcc 3.1, you add -ftemplate-depth-250, or some other high number, then it seems to work.
From: rodrigc@gcc.gnu.org To: gcc-bugs@gcc.gnu.org, gcc-gnats@gcc.gnu.org, gcc-prs@gcc.gnu.org, georg.wild@gmx.de, nobody@gcc.gnu.org Cc: Subject: Re: c++/5050: template instantiation depth exceeds/maybe recursion problem Date: 8 Dec 2001 17:43:08 -0000 Synopsis: template instantiation depth exceeds/maybe recursion problem State-Changed-From-To: open->analyzed State-Changed-By: rodrigc State-Changed-When: Sat Dec 8 09:43:07 2001 State-Changed-Why: Reproduced in latest CVS. Works with no problem with gcc 3.0.3. If in gcc 3.1, you add -ftemplate-depth-250, or some other high number, then it seems to work. http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&pr=5050&database=gcc
State-Changed-From-To: analyzed-feedback State-Changed-Why: Seems fixed now.
From: Tim Bagot <tbagot@bluearc.com> To: "'gcc-gnats@gcc.gnu.org'" <gcc-gnats@gcc.gnu.org>, "'gcc-prs@gcc.gnu.org'" <gcc-prs@gcc.gnu.org>, "'georg.wild@gmx.de'" <georg.wild@gmx.de>, "'gcc-bugs@gcc.gnu.org'" <gcc-bugs@gcc.gnu.org>, "'nobody@gcc.gnu.org'" <nobody@gcc.gnu.org> Cc: Subject: Re: c++/5050: template instantiation depth exceeds/maybe recursio n problem Date: Fri, 27 Sep 2002 17:56:47 +0100 http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&pr=5050&databa se=gcc > State-Changed-From-To: analyzed-feedback > State-Changed-By: jason > State-Changed-When: Tue Apr 9 18:23:37 2002 > State-Changed-Why: > Seems fixed now. With gcc-3.2 I see the same problem with the following code, compiled using gcc -c -ftemplate-depth-17 -O2 . (Without optimisation turned on it is fine.) struct ostream { template<class T> ostream & operator <<( const T & ) { return *this; } }; void foo(ostream& os) { os<<1<<2<<3<<4<<5<<6<<7<<8<<9<<10<<11<<12<<13<<14<<15<<16<<17<<18; } ********************************************************************* This e-mail and any attachment is confidential. It may only be read, copied and used by the intended recipient(s). If you are not the intended recipient(s), you may not copy, use, distribute, forward, store or disclose this e-mail or any attachment. If you are not the intended recipient(s) or have otherwise received this e-mail in error, you should destroy it and any attachment and notify the sender by reply e-mail or send a message to sysadmin@bluearc.com *********************************************************************
From: Nathanael Nerode <neroden@twcny.rr.com> To: gcc-gnats@gcc.gnu.org, gcc-prs@gcc.gnu.org, georg.wild@gmx.de, gcc-bugs@gcc.gnu.org, nobody@gcc.gnu.org Cc: Subject: Re: c++/5050: template instantiation depth exceeds... Date: Sat, 11 Jan 2003 16:07:43 -0500 The following testcase fails when compiled with -ftemplate-depth-1 -O2 or -ftemplate-depth-1 -O1, but not -ftemplate-depth-1 -O0. (It's always OK with template depth higher than 1). This is the error message: ---- test.cxx:5: error: template instantiation depth exceeds maximum of 1 (use -ftemplate-depth-NN to increase the maximum) instantiating `ostream& ostream::foo(const T&) [with T = int]' test.cxx:5: instantiated from `ostream& ostream::foo(const T&) [with T = int]'test.cxx:12: instantiated from here ---- The problem appears to be that the compiler doesn't realize that it's already instantiated `ostream& ostream::foo(const T&) [with T = int]'. It doesn't have to instantiate it repeatedly, does it now? At any rate, behaving differently with optimization is a no-no. This is the testcase: ---- struct ostream { template<class T> ostream& foo( const T & ) { return *this; } }; void foo() { ostream os; (os.foo(1)).foo(2); } ----
From: Wolfgang Bangerth <bangerth@ticam.utexas.edu> To: gcc-bugs@gcc.gnu.org, <gcc-gnats@gcc.gnu.org> Cc: georg.wild@gmx.de, <neroden@twcny.rr.com> Subject: Re: c++/5050: template instantiation depth Date: Wed, 22 Jan 2003 13:11:12 -0600 (CST) This report is about the following code (extracted by Nathanael): -------------- struct ostream { template<class T> ostream& foo( const T & ) { return *this; } }; void foo() { ostream os; (os.foo(1)).foo(2); } ----------------- It compiles fine without optimization and -ftemplate-depth-1, since ostream::foo really needs to be instantiated only once. It fails with optimization -O saying that the maximal instantiation depth is exceeded. I think that this is actually a bug in the inliner, since the bug can be made to go away when one specifies "-O -fno-inline". My naive understanding is that the inliner just copies the body of the foo function into the calling place, so the function is not instantiated, although the instantiation counter is bumped up by one. When we get to the second call of foo(), we check that the function has not been instantiated, so needs to be instantiated now, but then the instantiation counter is already at 1, and we fail. The solution would probably be to not increase the template instantiation depth counter when a function is inlined, rather than instantiated. Regards Wolfgang ------------------------------------------------------------------------- Wolfgang Bangerth email: bangerth@ticam.utexas.edu www: http://www.ticam.utexas.edu/~bangerth/
State-Changed-From-To: feedback->analyzed State-Changed-Why: I don't think I even asked a question. The problem persists in any case (if anyone wants to look at this, read the audit trail from the bottom). W.
Still present.
*** Bug 8489 has been marked as a duplicate of this bug. ***
suspending as this is fixed on the tree-ssa branch so it will be fixed for 3.5.
Actually this is a regression :) From Phil's regression hunter: Search converges between 2001-12-02-trunk (#48) and 2001-12 -09-trunk (#49).
I think it is caused by this patch: <http://gcc.gnu.org/ml/gcc-patches/2001-12/ msg00514.html>.
Patch here: <http://gcc.gnu.org/ml/gcc-patches/2003-12/msg01871.html>.
Subject: Bug 5050 CVSROOT: /cvs/gcc Module name: gcc Changes by: pinskia@gcc.gnu.org 2003-12-22 20:42:59 Modified files: gcc/cp : ChangeLog cp-lang.c cp-tree.h tree.c gcc/testsuite : ChangeLog Added files: gcc/testsuite/g++.dg/template: recurse1.C Log message: 2003-12-22 Andrew Pinski <pinskia@physics.uc.edu> PR c++/5050 * tree.c (cp_start_inlining): Remove. (cp_end_inlining): Remove. * cp-lang.c (LANG_HOOKS_TREE_INLINING_START_INLINING): Do not define. (LANG_HOOKS_TREE_INLINING_END_INLINING): Do not define. * cp-tree.h (cp_start_inlining): Do not declare. (cp_end_inlining): Do not declare. PR c++/5050 * g++.dg/template/recurse1.C: New test. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&r1=1.3829&r2=1.3830 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/cp-lang.c.diff?cvsroot=gcc&r1=1.68&r2=1.69 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/cp-tree.h.diff?cvsroot=gcc&r1=1.942&r2=1.943 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/tree.c.diff?cvsroot=gcc&r1=1.358&r2=1.359 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&r1=1.3299&r2=1.3300 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/g++.dg/template/recurse1.C.diff?cvsroot=gcc&r1=NONE&r2=1.1
Any a 3.3 regression now.
Subject: Bug 5050 CVSROOT: /cvs/gcc Module name: gcc Branch: gcc-3_3-branch Changes by: pinskia@gcc.gnu.org 2003-12-22 21:01:02 Modified files: gcc/cp : ChangeLog cp-lang.c cp-tree.h tree.c gcc/testsuite : ChangeLog Log message: 2003-12-22 Andrew Pinski <pinskia@physics.uc.edu> PR c++/5050 * tree.c (cp_start_inlining): Remove. (cp_end_inlining): Remove. * cp-lang.c (LANG_HOOKS_TREE_INLINING_START_INLINING): Do not define. (LANG_HOOKS_TREE_INLINING_END_INLINING): Do not define. * cp-tree.h (cp_start_inlining): Do not declare. (cp_end_inlining): Do not declare. PR c++/5050 * g++.dg/template/recurse1.C: New test. Patches: http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.3076.2.226&r2=1.3076.2.227 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/cp-lang.c.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.43.2.2&r2=1.43.2.3 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/cp-tree.h.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.776.2.36&r2=1.776.2.37 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/cp/tree.c.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.307.2.6&r2=1.307.2.7 http://gcc.gnu.org/cgi-bin/cvsweb.cgi/gcc/gcc/testsuite/ChangeLog.diff?cvsroot=gcc&only_with_tag=gcc-3_3-branch&r1=1.2261.2.342&r2=1.2261.2.343
Fixed.