This is the mail archive of the gcc-patches@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]

Re: [PATCH] Fix PR c++/5050: template instantiation depth exceeds/maybe recursion optimizing



On Dec 22, 2003, at 12:17, Jason Merrill wrote:


On Sun, 21 Dec 2003 17:18:13 -0800, Andrew Pinski <pinskia@physics.uc.edu> wrote:

The problem here is caused by the patch which was to fix the testcase
g++.dg/template/recurse.C:
<http://gcc.gnu.org/ml/gcc-patches/2001-12/msg00514.html>.
In fact that testcase was fixed before as Phil's regression hunter shows:
Search converges between 2001-07-15-trunk (#28) and 2001-07-22-trunk (#29).

I have a lot of trouble believing that one of the C++ patches between those
dates could have fixed that bug. But I agree that the patch you cite was
wrong, and if it doesn't break recurse.C your patch is OK.



My patch does not break recurse.C at all. Here is the testcase I committed also:

testsuite/g++.dg/template/recurse1.C:

// PR c++/5050
// Origin: georg.wild@gmx.de
// Reduced by: tbagot@bluearc.com and Nathanael C. Nerode <neroden@twcny.rr.com>
// Test for that excessive template recursion does not occur
// because of optimization.
// { dg-options "-ftemplate-depth-1 -O" }


 struct ostream  {
    template<class T> ostream& foo( const T & )
     { return *this;  }
  };

  void foo()  {
    ostream os;
    (os.foo(1)).foo(2);
  }


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