summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2007-03-30 08:03:55 +0000
committerhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>2007-03-30 08:03:55 +0000
commit5615be0fbc66201b0bc5d99d3557f3f06e7ef1f4 (patch)
treec769955fda0ddd702dbc5211fce66e9f31aa7ad9
parent337d8bc191742db06b76214d37c05d9147c771fe (diff)
downloadppe42-gcc-5615be0fbc66201b0bc5d99d3557f3f06e7ef1f4.tar.gz
ppe42-gcc-5615be0fbc66201b0bc5d99d3557f3f06e7ef1f4.zip
PR middle-end/PR30700
* dwarf2out.c (reference_to_unused): Ask cgraph for functions availablility; add more sanity checking; ask varpool only about VAR_DECL. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@123358 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog7
-rw-r--r--gcc/dwarf2out.c14
2 files changed, 20 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 31cddc01829..ffb6de486fa 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,10 @@
+2007-03-30 Jan Hubicka <jh@suse.cz>
+
+ PR middle-end/PR30700
+ * dwarf2out.c (reference_to_unused): Ask cgraph for functions
+ availablility; add more sanity checking; ask varpool only about
+ VAR_DECL.
+
2007-03-29 Richard Henderson <rth@redhat.com>
* unwind-generic.h (_sleb128_t, _uleb128_t): Don't use HAVE_LONG_LONG
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index fa00452e594..57c8617a1f2 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;
}
OpenPOWER on IntegriCloud