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 c++/15721] [3.5.0 regression] template instantation omits static data members


------- Additional Comments From pinskia at gcc dot gnu dot org  2004-06-02 00:42 -------
This should work (I have tested it on the testcase though), I have not bootstrapped and tested it yet:
Index: toplev.c
===============================================================
====
RCS file: /cvs/gcc/gcc/gcc/toplev.c,v
retrieving revision 1.899
diff -u -p -r1.899 toplev.c
--- toplev.c    30 May 2004 18:32:27 -0000      1.899
+++ toplev.c    2 Jun 2004 00:41:09 -0000
@@ -1455,16 +1455,17 @@ wrapup_global_declarations (tree *vec, i
 
          if (TREE_CODE (decl) == VAR_DECL && TREE_STATIC (decl))
            {
+              struct cgraph_varpool_node *node;
              bool needed = 1;
+              node = cgraph_varpool_node (decl);
 
-             if (flag_unit_at_a_time
-                 && cgraph_varpool_node (decl)->finalized)
+             if (node && node->finalized)
                needed = 0;
              else if ((flag_unit_at_a_time && !cgraph_global_info_ready)
                       && (TREE_USED (decl)
                           || TREE_USED (DECL_ASSEMBLER_NAME (decl))))
                /* needed */;
-             else if (TREE_SYMBOL_REFERENCED (DECL_ASSEMBLER_NAME (decl)))
+             else if (node && node->needed)
                /* needed */;
              else if (DECL_COMDAT (decl))
                needed = 0;

-- 


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


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