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 22204


This patch fixes an ICE-on-valid regression in 4.0.x; we were looking
at CLASSTYPE_TEMPLATE_INSTANTIATION without checking
TYPE_LANG_SPECIFIC.

Tested on x86_64-unknown-linux-gnu, applied on the mainline.

--
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com

2005-07-15  Mark Mitchell  <mark@codesourcery.com>

	PR c++/22204
	* repo.c (repo_emit_p): Robustify.

2005-07-15  Mark Mitchell  <mark@codesourcery.com>

	PR c++/22204
	* g++.dg/rtti/repo1.C: New test.

Index: gcc/cp/repo.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/repo.c,v
retrieving revision 1.58
diff -c -5 -p -r1.58 repo.c
*** gcc/cp/repo.c	25 Jun 2005 00:58:15 -0000	1.58
--- gcc/cp/repo.c	16 Jul 2005 00:22:14 -0000
*************** repo_emit_p (tree decl)
*** 283,293 ****
        if (DECL_VTABLE_OR_VTT_P (decl))
  	type = DECL_CONTEXT (decl);
        else if (DECL_TINFO_P (decl))
  	type = TREE_TYPE (DECL_NAME (decl));
        if (!DECL_TEMPLATE_INSTANTIATION (decl)
! 	  && !CLASSTYPE_TEMPLATE_INSTANTIATION (type))
  	return 2;
      }
    else if (!DECL_TEMPLATE_INSTANTIATION (decl))
      return 2;
  
--- 283,294 ----
        if (DECL_VTABLE_OR_VTT_P (decl))
  	type = DECL_CONTEXT (decl);
        else if (DECL_TINFO_P (decl))
  	type = TREE_TYPE (DECL_NAME (decl));
        if (!DECL_TEMPLATE_INSTANTIATION (decl)
! 	  && (!TYPE_LANG_SPECIFIC (type)
! 	      || !CLASSTYPE_TEMPLATE_INSTANTIATION (type)))
  	return 2;
      }
    else if (!DECL_TEMPLATE_INSTANTIATION (decl))
      return 2;
  
Index: gcc/testsuite/g++.dg/rtti/repo1.C
===================================================================
RCS file: gcc/testsuite/g++.dg/rtti/repo1.C
diff -N gcc/testsuite/g++.dg/rtti/repo1.C
*** /dev/null	1 Jan 1970 00:00:00 -0000
--- gcc/testsuite/g++.dg/rtti/repo1.C	16 Jul 2005 00:22:14 -0000
***************
*** 0 ****
--- 1,15 ----
+ // PR c++/22204
+ // { dg-options "-frepo" }
+ 
+ #include <typeinfo>
+ template<int>
+ struct function1
+ {
+   function1()
+   {
+     typeid(int[100]);
+   }
+ };
+ function1<1> b;
+ 
+ int main () {}


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