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]

Re: cc1plus cores



    The compiler runs much better when functions don't clobber
    their return addresses.

Thanks for the patch.  Why don't these things ever fail for me, even
when I run the testsuite? :-(

	    * pt.c (process_partial_specialization): Consistantly allocate
	    and zero tpd.parms based on ntparms.

Actually, only the first hunk is correct; the others are correct as
is; your change will result in array overruns.  But, that's because of
another typo (mine) in the original source, which confused you.

Here's the patch.

-- 
Mark Mitchell 			mark@markmitchell.com
Mark Mitchell Consulting	http://www.markmitchell.com

1998-09-08  Richard Henderson  <rth@cygnus.com>
	    Mark Mitchell  <mark@markmitchell.com>	
	
	* pt.c (process_partial_specialization): Consistantly allocate
	and zero tpd.parms based on ntparms.  Use tpd2.parms, not
	tpd.parms, where appropriate.

Index: pt.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/pt.c,v
retrieving revision 1.201
diff -c -p -r1.201 pt.c
*** pt.c	1998/09/07 14:25:23	1.201
--- pt.c	1998/09/08 15:59:03
*************** process_partial_specialization (decl)
*** 1912,1918 ****
       or some such would have been OK.  */
    tpd.level = TMPL_PARMS_DEPTH (current_template_parms);
    tpd.parms = alloca (sizeof (int) * ntparms);
!   bzero (tpd.parms, sizeof (int) * nargs);
  
    tpd.arg_uses_template_parms = alloca (sizeof (int) * nargs);
    bzero (tpd.arg_uses_template_parms, sizeof (int) * nargs);
--- 1912,1918 ----
       or some such would have been OK.  */
    tpd.level = TMPL_PARMS_DEPTH (current_template_parms);
    tpd.parms = alloca (sizeof (int) * ntparms);
!   bzero (tpd.parms, sizeof (int) * ntparms);
  
    tpd.arg_uses_template_parms = alloca (sizeof (int) * nargs);
    bzero (tpd.arg_uses_template_parms, sizeof (int) * nargs);
*************** process_partial_specialization (decl)
*** 1985,1990 ****
--- 1985,1993 ----
  		  /* We haven't yet initialized TPD2.  Do so now.  */
  		  tpd2.arg_uses_template_parms 
  		    =  (int*) alloca (sizeof (int) * nargs);
+ 		  /* The number of paramters here is the number in the
+ 		     main template, which, as checked in the assertion
+ 		     above, is NARGS.  */
  		  tpd2.parms = (int*) alloca (sizeof (int) * nargs);
  		  tpd2.level = 
  		    TMPL_PARMS_DEPTH (DECL_TEMPLATE_PARMS (maintmpl));
*************** process_partial_specialization (decl)
*** 1995,2001 ****
  		 template, not in the specialization.  */
  	      tpd2.current_arg = i;
  	      tpd2.arg_uses_template_parms[i] = 0;
! 	      bzero (tpd.parms, sizeof (int) * nargs);
  	      for_each_template_parm (type,
  				      &mark_template_parm,
  				      &tpd2);
--- 1998,2004 ----
  		 template, not in the specialization.  */
  	      tpd2.current_arg = i;
  	      tpd2.arg_uses_template_parms[i] = 0;
! 	      bzero (tpd2.parms, sizeof (int) * nargs);
  	      for_each_template_parm (type,
  				      &mark_template_parm,
  				      &tpd2);


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