[C++ Patch]Re: [Bug optimization/11421] [3.4 regression] vtables are not emitted in unit-at-a-time mode
Jan Hubicka
jh@suse.cz
Tue Jul 8 13:27:00 GMT 2003
> >
> >>--- 1635,1641 ----
> >> {
> >> tree vtbl;
> >> tree primary_vtbl;
> >>+ bool needed;
> >
> >
> > Shouldn't this be initialized to false?
> >
> >
> >>--- 1663,1671 ----
> >> note_debug_info_needed (ctype);
> >> return false;
> >> }
> >>+ else if (TREE_PUBLIC (vtbl) && !DECL_COMDAT (vtbl))
> >>+ needed = 1;
> >>+
> >
> >
> > And this should probably be true instead of 1...
>
> Jan's patch with your corrections does the trick, and my code compiles
> again. Thanks very much!
>
Thanks for spotting it. Bit too much hurry :*(
I noticed it while bootstrapping the patch too, here is updated one that
bootstraps and regtests fully.
Mon Jul 7 23:34:24 CEST 2003 Jan Hubicka <jh@suse.cz>
* decl2.c (maybe_emit_vtables): Fix marking vtables as needed in
unit-at-a-time
Index: decl2.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/decl2.c,v
retrieving revision 1.642
diff -c -3 -p -r1.642 decl2.c
*** decl2.c 6 Jul 2003 23:23:44 -0000 1.642
--- decl2.c 7 Jul 2003 21:32:13 -0000
*************** maybe_emit_vtables (tree ctype)
*** 1635,1640 ****
--- 1635,1641 ----
{
tree vtbl;
tree primary_vtbl;
+ bool needed = false;
/* If the vtables for this class have already been emitted there is
nothing more to do. */
*************** maybe_emit_vtables (tree ctype)
*** 1652,1658 ****
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,
--- 1653,1658 ----
*************** maybe_emit_vtables (tree ctype)
*** 1663,1668 ****
--- 1663,1671 ----
note_debug_info_needed (ctype);
return false;
}
+ else if (TREE_PUBLIC (vtbl) && !DECL_COMDAT (vtbl))
+ needed = true;
+
/* The ABI requires that we emit all of the vtables if we emit any
of them. */
*************** maybe_emit_vtables (tree ctype)
*** 1673,1679 ****
mark_vtable_entries (vtbl);
/* If we know that DECL is needed, mark it as such for the varpool. */
! if (CLASSTYPE_EXPLICIT_INSTANTIATION (ctype))
cgraph_varpool_mark_needed_node (cgraph_varpool_node (vtbl));
if (TREE_TYPE (DECL_INITIAL (vtbl)) == 0)
--- 1676,1682 ----
mark_vtable_entries (vtbl);
/* If we know that DECL is needed, mark it as such for the varpool. */
! if (needed)
cgraph_varpool_mark_needed_node (cgraph_varpool_node (vtbl));
if (TREE_TYPE (DECL_INITIAL (vtbl)) == 0)
More information about the Gcc-patches
mailing list