From 7a3c4b3ef39ecd9b3d7aab86f188871d9ea5f11a Mon Sep 17 00:00:00 2001 From: Doug Kwan Date: Wed, 3 Oct 2007 10:01:43 +0000 Subject: [PATCH] re PR debug/31899 (-g and using declaration causing ICE in reference_to_unused) 2007-10-03 Doug Kwan Richard Guenther PR debug/31899 * dwarf2out.c (reference_to_unused): Disable sanity checking, be conservative instead. * g++.dg/debug/using3.C: New testcase. Co-Authored-By: Richard Guenther From-SVN: r128978 --- gcc/ChangeLog | 7 +++++++ gcc/dwarf2out.c | 5 ++++- gcc/testsuite/ChangeLog | 6 ++++++ gcc/testsuite/g++.dg/debug/using3.C | 8 ++++++++ 4 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/debug/using3.C diff --git a/gcc/ChangeLog b/gcc/ChangeLog index d08395db2eb..02f3040d37a 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,10 @@ +2007-10-03 Doug Kwan + Richard Guenther + + PR debug/31899 + * dwarf2out.c (reference_to_unused): Disable sanity checking, + be conservative instead. + 2007-10-03 Francois-Xavier Coudert PR fortran/26682 diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 9ca68fb4207..05fd44576ae 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -10344,9 +10344,12 @@ reference_to_unused (tree * tp, int * walk_subtrees, return *tp; else if (!flag_unit_at_a_time) return NULL_TREE; + /* ??? The C++ FE emits debug information for using decls, so + putting gcc_unreachable here falls over. See PR31899. For now + be conservative. */ else if (!cgraph_global_info_ready && (TREE_CODE (*tp) == VAR_DECL || TREE_CODE (*tp) == FUNCTION_DECL)) - gcc_unreachable (); + return *tp; else if (DECL_P (*tp) && TREE_CODE (*tp) == VAR_DECL) { struct varpool_node *node = varpool_node (*tp); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 0f2e06fc58d..216454d5f0c 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,9 @@ +2007-10-03 Doug Kwan + Richard Guenther + + PR debug/31899 + * g++.dg/debug/using3.C: New testcase. + 2007-10-03 Jerry DeLisle PR libfortran/33253 diff --git a/gcc/testsuite/g++.dg/debug/using3.C b/gcc/testsuite/g++.dg/debug/using3.C new file mode 100644 index 00000000000..df3e3dfa3a1 --- /dev/null +++ b/gcc/testsuite/g++.dg/debug/using3.C @@ -0,0 +1,8 @@ +// PR debug/31899 + +namespace NS { + int x = 0; + int &ref = x; +} + +using NS::ref; -- 2.30.2