This is the mail archive of the gcc-bugs@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]

[Bug optimization/11421] [3.4 regression] vtables are not emitted in unit-at-a-time mode


PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11421



------- Additional Comments From jh at suse dot cz  2003-07-07 21:36 -------
Subject: Re:  [3.4 regression] vtables are not emitted in unit-at-a-time mode

> PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.
> 
> http://gcc.gnu.org/bugzilla/show_bug.cgi?id=11421
> 
> 
> 
> ------- Additional Comments From martin at mpa-garching dot mpg dot de  2003-07-07 09:53 -------
> Subject: Re:  [3.4 regression] vtables are not emitted
>  in unit-at-a-time mode
> 
> Hi,
> 
> I finally have a testcase that reproduces the problem even with your
> patch applied. Hopefully it helps you identify the problem; I'm
> more or less at my wits' end.

Hi,
it is again problem with marking vtables as needed.  I don't quite
understand the rules, but it seems to me that all public vtables must be
output.  This is at least what old code did because it uses
DECL_NEEDED_P that test it this way.  This patch changes the code to
imitate it in unit-at-a-time (for PUBLIC and !COMDAT vtables before
comdat_linkage is called we mark the vtables as needed).

Does this look OK?

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;
  
    /* 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 = 1;
+   
  
    /* 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)


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