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]

C++ PATCH: PR c++/10446


This patch fixes PR c++/10446, fall-out from one of the patches to
speed up name lookup, IIRC.

Tested on i686-pc-linux-gnu, applied on the mainline and on the
branch.

--
Mark Mitchell
CodeSourcery, LLC
mark at codesourcery dot com


2003-04-22  Mark Mitchell  <mark at codesourcery dot com>

	PR c++/10446
	* search.c (lookup_fnfields_1): Handle empty slots in the method
	vector.

2003-04-22  Mark Mitchell  <mark at codesourcery dot com>

	PR c++/10446
	* g++.dg/parse/crash3.C: New test.

Index: cp/search.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/search.c,v
retrieving revision 1.259
diff -c -5 -p -r1.259 search.c
*** cp/search.c	20 Apr 2003 11:48:35 -0000	1.259
--- cp/search.c	22 Apr 2003 22:47:57 -0000
*************** lookup_fnfields_1 (tree type, tree name)
*** 1398,1410 ****
  
  #ifdef GATHER_STATISTICS
  		  n_outer_fields_searched++;
  #endif /* GATHER_STATISTICS */
  
! 		  tmp = DECL_NAME (OVL_CURRENT (methods[i]));
! 
! 		  if (tmp > name)
  		    hi = i;
  		  else if (tmp < name)
  		    lo = i + 1;
  		  else
  		    return i;
--- 1398,1415 ----
  
  #ifdef GATHER_STATISTICS
  		  n_outer_fields_searched++;
  #endif /* GATHER_STATISTICS */
  
! 		  tmp = methods[i];
! 		  /* This slot may be empty; we allocate more slots
! 		     than we need.  In that case, the entry we're
! 		     looking for is closer to the beginning of the
! 		     list. */
! 		  if (tmp)
! 		    tmp = DECL_NAME (OVL_CURRENT (tmp));
! 		  if (!tmp || tmp > name)
  		    hi = i;
  		  else if (tmp < name)
  		    lo = i + 1;
  		  else
  		    return i;
Index: testsuite/g++.dg/parse/crash3.C
===================================================================
RCS file: testsuite/g++.dg/parse/crash3.C
diff -N testsuite/g++.dg/parse/crash3.C
*** /dev/null	1 Jan 1970 00:00:00 -0000
--- testsuite/g++.dg/parse/crash3.C	22 Apr 2003 22:49:03 -0000
***************
*** 0 ****
--- 1,2 ----
+ template <class T> struct L { struct I {}; };
+ template <class T> void L<T>::I::foo() {} // { dg-error "" }


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