passes.c (rest_of_decl_compilation): Do not add local vars into varpol.
authorJan Hubicka <jh@suse.cz>
Fri, 3 Sep 2010 09:58:21 +0000 (11:58 +0200)
committerJan Hubicka <hubicka@gcc.gnu.org>
Fri, 3 Sep 2010 09:58:21 +0000 (09:58 +0000)
* passes.c (rest_of_decl_compilation): Do not add local vars into varpol.
* varpool.c (varpool_get_node, varpool_node): Sanity check that only
static or extern vars are in varpool.
(varpool_finalize_decl): Sanity check that only static vars are finalized.

From-SVN: r163804

gcc/ChangeLog
gcc/passes.c
gcc/varpool.c

index d313703e62a33c48a47b93bba213c70acca8e6d7..5e24826a5447c1dee926d022595a163b4ea9602d 100644 (file)
@@ -1,3 +1,10 @@
+2010-09-03  Jan Hubicka  <jh@suse.cz>
+
+       * passes.c (rest_of_decl_compilation): Do not add local vars into varpol.
+       * varpool.c (varpool_get_node, varpool_node): Sanity check that only
+       static or extern vars are in varpool.
+       (varpool_finalize_decl): Sanity check that only static vars are finalized.
+
 2010-09-03  Jakub Jelinek  <jakub@redhat.com>
 
        PR debug/45500
index 4823c6397c27ef59ee8f1ab27175fd57cf07095c..88da9b35632490064746d84e0ae0f243ef0324d2 100644 (file)
@@ -219,7 +219,8 @@ rest_of_decl_compilation (tree decl,
   /* Let cgraph know about the existence of variables.  */
   if (in_lto_p && !at_end)
     ;
-  else if (TREE_CODE (decl) == VAR_DECL && !DECL_EXTERNAL (decl))
+  else if (TREE_CODE (decl) == VAR_DECL && !DECL_EXTERNAL (decl)
+          && TREE_STATIC (decl))
     varpool_node (decl);
 }
 
index dcf3518db632a7038e2f6b2468a0f8d3e2a87648..817a3197901e81528727340a1a1804c2f60ac7ae 100644 (file)
@@ -111,7 +111,8 @@ varpool_get_node (tree decl)
 {
   struct varpool_node key, **slot;
 
-  gcc_assert (DECL_P (decl) && TREE_CODE (decl) != FUNCTION_DECL);
+  gcc_assert (TREE_CODE (decl) == VAR_DECL
+             && (TREE_STATIC (decl) || DECL_EXTERNAL (decl)));
 
   if (!varpool_hash)
     return NULL;
@@ -129,7 +130,8 @@ varpool_node (tree decl)
 {
   struct varpool_node key, *node, **slot;
 
-  gcc_assert (DECL_P (decl) && TREE_CODE (decl) != FUNCTION_DECL);
+  gcc_assert (TREE_CODE (decl) == VAR_DECL
+             && (TREE_STATIC (decl) || DECL_EXTERNAL (decl)));
 
   if (!varpool_hash)
     varpool_hash = htab_create_ggc (10, hash_varpool_node,
@@ -365,6 +367,8 @@ varpool_finalize_decl (tree decl)
 {
   struct varpool_node *node = varpool_node (decl);
 
+  gcc_assert (TREE_STATIC (decl));
+
   /* The first declaration of a variable that comes through this function
      decides whether it is global (in C, has external linkage)
      or local (in C, has internal linkage).  So do nothing more