aboutsummaryrefslogtreecommitdiff
path: root/gcc/varpool.c
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2010-09-03 09:58:21 +0000
committerJan Hubicka <jh@suse.cz>2010-09-03 09:58:21 +0000
commit91466334df008830769c14ce7c56a87e125851f4 (patch)
tree1a0056a61f675aa9f60f5f9ea43861c09f244e5f /gcc/varpool.c
parent58187de33cf80c83bbdfb3ddc116e81e64f63670 (diff)
* 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. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@163804 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/varpool.c')
-rw-r--r--gcc/varpool.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/gcc/varpool.c b/gcc/varpool.c
index dcf3518db63..817a3197901 100644
--- a/gcc/varpool.c
+++ b/gcc/varpool.c
@@ -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