This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[PATCH] Fix PR30700, link failure with debugging
- From: Richard Guenther <rguenther at suse dot de>
- To: gcc-patches at gcc dot gnu dot org
- Cc: Jan Hubicka <jh at suse dot cz>
- Date: Tue, 20 Feb 2007 17:15:51 +0100 (CET)
- Subject: [PATCH] Fix PR30700, link failure with debugging
This is another variant of PR27657, this time with referencing to
a removed function.
Bootstrap and regtest in progress. Honza, does this look sane?
Thanks,
Richard.
2007-02-20 Richard Guenther <rguenther@suse.de>
PR middle-end/30700
* dwarf2out.c (reference_to_unused): Query cgraph for function
declarations.
* g++.dg/debug/pr30700.C: New testcase.
Index: dwarf2out.c
===================================================================
*** dwarf2out.c (revision 122165)
--- dwarf2out.c (working copy)
*************** reference_to_unused (tree * tp, int * wa
*** 10079,10089 ****
{
if (! EXPR_P (*tp) && ! GIMPLE_STMT_P (*tp) && ! CONSTANT_CLASS_P (*tp))
*walk_subtrees = 0;
!
! 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)
{
struct varpool_node *node = varpool_node (*tp);
if (!node->needed)
--- 10079,10100 ----
{
if (! EXPR_P (*tp) && ! GIMPLE_STMT_P (*tp) && ! CONSTANT_CLASS_P (*tp))
*walk_subtrees = 0;
!
! if (! DECL_P (*tp))
! return NULL_TREE;
!
! if (! TREE_PUBLIC (*tp)
! && ! TREE_USED (*tp)
&& ! TREE_ASM_WRITTEN (*tp))
return *tp;
!
! if (TREE_CODE (*tp) == FUNCTION_DECL)
! {
! struct cgraph_node *node = cgraph_node (*tp);
! if (!node->needed)
! return *tp;
! }
! else
{
struct varpool_node *node = varpool_node (*tp);
if (!node->needed)
Index: testsuite/g++.dg/debug/pr30700.C
===================================================================
*** testsuite/g++.dg/debug/pr30700.C (revision 0)
--- testsuite/g++.dg/debug/pr30700.C (revision 0)
***************
*** 0 ****
--- 1,6 ----
+ /* { dg-do link } */
+
+ static void sand_window_create_shape (int test) {}
+ static void (* const b) (int test) = sand_window_create_shape;
+
+ int main() {}