This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[3.3,3.4,mainline, C++ patch] PR C++/14865
- From: Jan Hubicka <jh at suse dot cz>
- To: gcc-patches at gcc dot gnu dot org, mark at codesourcery dot com
- Date: Thu, 24 Jun 2004 22:24:39 +0200
- Subject: [3.3,3.4,mainline, C++ patch] PR C++/14865
Hi,
the problem appears to be caused by fact that we suceed to fully inline
everything and optimize everything out except for single reference into VTT
table. Since non-unit-at-a-time does the reachability analysis based on
symbols output to assembly file, it must notice this single VTT, but it fails
to do so, because maybe_emit_vtable produces correct linkage only for the
primary table and not the VTT one. I guess this does not matter in
non-degenerated cases as primary table is needed for every constructor.
Regtested on i686-pc-gnu-linux, full bootstrap/regtest in progress, OK if it passes?
struct A
{
virtual ~A() {}
};
struct B : public virtual A {};
template <typename> struct C : public B {};
int main()
{
C<int> c;
return 0;
}
PR C++/14865
* decl2.c (maybe_emit_vtables): Always import_export_vtable for the
reachability analysis.
diff -Ncp ../../gcc.old/gcc/cp/decl2.c cp/decl2.c
*** ../../gcc.old/gcc/cp/decl2.c Fri Jun 18 18:22:04 2004
--- cp/decl2.c Thu Jun 24 15:44:41 2004
*************** maybe_emit_vtables (tree ctype)
*** 1579,1590 ****
return false;
import_export_class (ctype);
- import_export_vtable (primary_vtbl, ctype, 1);
/* See if any of the vtables are needed. */
for (vtbl = CLASSTYPE_VTABLES (ctype); vtbl; vtbl = TREE_CHAIN (vtbl))
! if (!DECL_EXTERNAL (vtbl) && DECL_NEEDED_P (vtbl))
! break;
if (!vtbl)
{
/* If the references to this class' vtables are optimized away,
--- 1579,1592 ----
return false;
import_export_class (ctype);
/* See if any of the vtables are needed. */
for (vtbl = CLASSTYPE_VTABLES (ctype); vtbl; vtbl = TREE_CHAIN (vtbl))
! {
! import_export_vtable (vtbl, ctype, 1);
! if (!DECL_EXTERNAL (vtbl) && DECL_NEEDED_P (vtbl))
! break;
! }
if (!vtbl)
{
/* If the references to this class' vtables are optimized away,