aboutsummaryrefslogtreecommitdiff
path: root/gcc/dwarf2out.c
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2007-03-30 10:03:55 +0200
committerJan Hubicka <hubicka@gcc.gnu.org>2007-03-30 08:03:55 +0000
commit4f40bddfb0e55c7b388d87d25cf4ef4c69543a79 (patch)
treec769955fda0ddd702dbc5211fce66e9f31aa7ad9 /gcc/dwarf2out.c
parentcc5e1fab404f5c6c6f6f7e79c5626fc681eae97d (diff)
downloadgcc-4f40bddfb0e55c7b388d87d25cf4ef4c69543a79.zip
gcc-4f40bddfb0e55c7b388d87d25cf4ef4c69543a79.tar.gz
gcc-4f40bddfb0e55c7b388d87d25cf4ef4c69543a79.tar.bz2
PR middle-end/PR30700
PR middle-end/PR30700 * dwarf2out.c (reference_to_unused): Ask cgraph for functions availablility; add more sanity checking; ask varpool only about VAR_DECL. From-SVN: r123358
Diffstat (limited to 'gcc/dwarf2out.c')
-rw-r--r--gcc/dwarf2out.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index fa00452..57c8617 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -10121,12 +10121,24 @@ reference_to_unused (tree * tp, int * walk_subtrees,
if (DECL_P (*tp) && ! TREE_PUBLIC (*tp) && ! TREE_USED (*tp)
&& ! TREE_ASM_WRITTEN (*tp))
return *tp;
- else if (DECL_P (*tp) && TREE_CODE (*tp) != FUNCTION_DECL)
+ else if (!flag_unit_at_a_time)
+ return NULL_TREE;
+ else if (!cgraph_global_info_ready
+ && (TREE_CODE (*tp) == VAR_DECL || TREE_CODE (*tp) == FUNCTION_DECL))
+ gcc_unreachable ();
+ else if (DECL_P (*tp) && TREE_CODE (*tp) == VAR_DECL)
{
struct varpool_node *node = varpool_node (*tp);
if (!node->needed)
return *tp;
}
+ else if (DECL_P (*tp) && TREE_CODE (*tp) == FUNCTION_DECL
+ && (!DECL_EXTERNAL (*tp) || DECL_DECLARED_INLINE_P (*tp)))
+ {
+ struct cgraph_node *node = cgraph_node (*tp);
+ if (!node->output)
+ return *tp;
+ }
return NULL_TREE;
}