rtti.c: honor-std + new-abi: __vmi_class_type_info not in std::

Alfred Minarik a8601248@unet.univie.ac.at
Fri Feb 25 11:42:00 GMT 2000


I could not resist trying the new new-abi and failed quite at the first link: 

While in the runtime libgcc.a (tinfo.h) 
class __vmi_class_type_info is declared in std:: ,
this seems to be missed in rtti.c
resulting in a linktime error.

Example:
[ compiler build with -fhonor-std -fnew-abi 
[ gcc version 2.96 20000224 (experimental) 
[ i686-pc-linux-gnu

---bug.cpp---
struct A {};

struct B {
  virtual ~B(){}
};

struct C: A, B {};

main() {
  return 0;
}
---
>gcc bug.cpp -fhonor-std -fnew-abi
/tmp/ccXdTKMb.o(.gnu.linkonce.d.__ti1C+0x0): undefined reference to `__vmi_class_type_info virtual table'
collect2: ld returned 1 exit status
---

Analogous to other uses in rtti.c 
the following seems to fix it.

Alfred

----------------------
ChangeLog:

2000-02-25  Alfred Minarik <a8601248@unet.univie.ac.at>

	* rtti.c (get_vmi_pseudo_type_info): move __vmi_class_type_info
	pseudo_type_info creation into std::

----------------------

*** /home/internet/cvs_egcs/egcs/gcc/cp/rtti.c	Sat Jan 29 18:30:34 2000
--- rtti.c	Fri Feb 25 10:29:40 2000
***************
*** 1733,1744 ****
--- 1733,1751 ----
    array_domain = build_index_type (build_int_2 (num_bases, 0));
    base_array = build_array_type (base_desc_type_node, array_domain);
  
+   if (flag_honor_std)
+     push_namespace (get_identifier ("std"));
+ 
    desc = create_pseudo_type_info
              ("__vmi_class_type_info", num_bases,
               build_lang_decl (FIELD_DECL, NULL_TREE, integer_type_node),
               build_lang_decl (FIELD_DECL, NULL_TREE, integer_type_node),
               build_lang_decl (FIELD_DECL, NULL_TREE, base_array),
               NULL);
+ 
+   if (flag_honor_std)
+     pop_namespace ();
+ 
    TREE_VEC_ELT (vmi_class_desc_type_node, num_bases) = desc;
    return desc;
  }


More information about the Gcc-patches mailing list