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]

Re: auto_ptr ICE 20000422 with gcc version 20000530



Fixed thus.  Thanks!

--
Mark Mitchell                   mark@codesourcery.com
CodeSourcery, LLC               http://www.codesourcery.com

2000-05-31  Mark Mitchell  <mark@codesourcery.com>

	* decl.c (build_cp_library_fn): Set DECL_CONTEXT.

	* method.c (mangle_expression): Adjust test for legal expression
	operators.

	* pt.c (instantiate_decl): Save and restore the local
	specializations list.

Index: testsuite/g++.old-deja/g++.pt/inline2.C
===================================================================
RCS file: inline2.C
diff -N inline2.C
*** /dev/null	Tue May  5 13:32:27 1998
--- inline2.C	Wed May 31 09:33:46 2000
***************
*** 0 ****
--- 1,16 ----
+ // Build don't link:
+ // Special g++ Options: -O
+ // Origin: Mark Mitchell <mitchell@codesourcery.com>
+ 
+ template <class T>
+ struct S {
+   inline ~S () {}
+ };
+ 
+ template <class T>
+ void f ()
+ {
+   static S<T> s;
+ }
+ 
+ template void f<int>();
Index: cp/decl.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/decl.c,v
retrieving revision 1.616
diff -c -p -r1.616 decl.c
*** decl.c	2000/05/30 15:44:19	1.616
--- decl.c	2000/05/31 16:33:57
*************** build_cp_library_fn (name, operator_code
*** 6821,6826 ****
--- 6821,6827 ----
  {
    tree fn = build_library_fn_1 (name, operator_code, type);
    TREE_NOTHROW (fn) = TYPE_NOTHROW_P (type);
+   DECL_CONTEXT (fn) = FROB_CONTEXT (current_namespace);
    set_mangled_name_for_decl (fn);
    make_function_rtl (fn);
    return fn;
Index: cp/method.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/method.c,v
retrieving revision 1.160
diff -c -p -r1.160 method.c
*** method.c	2000/05/28 02:58:15	1.160
--- method.c	2000/05/31 16:33:59
*************** mangle_expression (value)
*** 523,536 ****
        const char *name;
  
        name = operator_name_info[TREE_CODE (value)].mangled_name;
!       my_friendly_assert (name != NULL, 0);
!       if (name[0] != '_' || name[1] != '_')
  	/* On some erroneous inputs, we can get here with VALUE a
! 	   LOOKUP_EXPR.  In that case, the NAME will be the
! 	   identifier for "<invalid operator>".  We must survive
! 	   this routine in order to issue a sensible error
! 	   message, so we fall through to the case below.  */
  	goto bad_value;
  
        for (i = 0; i < operands; ++i)
  	{
--- 523,535 ----
        const char *name;
  
        name = operator_name_info[TREE_CODE (value)].mangled_name;
!       if (TREE_CODE (value) == LOOKUP_EXPR)
  	/* On some erroneous inputs, we can get here with VALUE a
! 	   LOOKUP_EXPR. We must survive this routine in order to issue
! 	   a sensible error message, so we fall through to the case
! 	   below.  */
  	goto bad_value;
+       my_friendly_assert (name != NULL, 0);
  
        for (i = 0; i < operands; ++i)
  	{
Index: cp/pt.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/pt.c,v
retrieving revision 1.429
diff -c -p -r1.429 pt.c
*** pt.c	2000/05/28 02:58:19	1.429
--- pt.c	2000/05/31 16:34:04
*************** instantiate_decl (d, defer_ok)
*** 9614,9621 ****
      }
    else if (TREE_CODE (d) == FUNCTION_DECL)
      {
        /* Set up the list of local specializations.  */
-       my_friendly_assert (local_specializations == NULL, 20000422);
        local_specializations = htab_create (37, 
  					   htab_hash_pointer,
  					   htab_eq_pointer,
--- 9614,9626 ----
      }
    else if (TREE_CODE (d) == FUNCTION_DECL)
      {
+       htab_t saved_local_specializations;
+ 
+       /* Save away the current list, in case we are instantiating one
+ 	 template from within the body of another.  */
+       saved_local_specializations = local_specializations;
+ 
        /* Set up the list of local specializations.  */
        local_specializations = htab_create (37, 
  					   htab_hash_pointer,
  					   htab_eq_pointer,
*************** instantiate_decl (d, defer_ok)
*** 9635,9641 ****
  
        /* We don't need the local specializations any more.  */
        htab_delete (local_specializations);
!       local_specializations = NULL;
  
        /* Finish the function.  */
        expand_body (finish_function (0));
--- 9640,9646 ----
  
        /* We don't need the local specializations any more.  */
        htab_delete (local_specializations);
!       local_specializations = saved_local_specializations;
  
        /* Finish the function.  */
        expand_body (finish_function (0));

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