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++] fix 20647


I've installed this patch to fix bug 20647. The typeinfo type string is not affected by incompleteness of the type itself.

built & tested on i686-pc-linux-gnu. I'll patch 4.1 and 4.2 presently.

nathan
--
Nathan Sidwell    ::   http://www.codesourcery.com   ::         CodeSourcery
nathan@codesourcery.com    ::     http://www.planetfall.pwp.blueyonder.co.uk

2006-10-22  Nathan Sidwell  <nathan@codesourcery.com>

	PR c++/20647
	* rtti.c (tinfo_base_init): The type info string is always global.

	PR c++/20647
	* g++.dg/abi/rtti3.C: New.

Index: gcc/cp/rtti.c
===================================================================
--- gcc/cp/rtti.c	(revision 117956)
+++ gcc/cp/rtti.c	(working copy)
@@ -824,13 +824,7 @@ tinfo_base_init (tinfo_s *ti, tree targe
     TREE_STATIC (name_decl) = 1;
     DECL_EXTERNAL (name_decl) = 0;
     DECL_TINFO_P (name_decl) = 1;
-    if (involves_incomplete_p (target))
-      {
-	TREE_PUBLIC (name_decl) = 0;
-	DECL_INTERFACE_KNOWN (name_decl) = 1;
-      }
-    else
-      set_linkage_according_to_type (target, name_decl);
+    set_linkage_according_to_type (target, name_decl);
     import_export_decl (name_decl);
     DECL_INITIAL (name_decl) = name_string;
     mark_used (name_decl);
Index: gcc/testsuite/g++.dg/abi/rtti3.C
===================================================================
--- gcc/testsuite/g++.dg/abi/rtti3.C	(revision 0)
+++ gcc/testsuite/g++.dg/abi/rtti3.C	(revision 0)
@@ -0,0 +1,13 @@
+// PR 20647, we must emit the typeinfo's string as weak, but not the
+// necessarily the type info object
+
+// { dg-require-weak "" }
+// { dg-final { scan-assembler ".weak\[ \t\]_?_ZTSPP1A" } }
+// { dg-final { scan-assembler-not ".weak\[ \t\]_?_ZTIPP1A" } }
+
+struct A;
+
+void Foo ()
+{
+  throw (A **)0;
+}

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