From: Richard Guenther Date: Wed, 10 Oct 2007 09:29:13 +0000 (+0000) Subject: backport: re PR debug/31899 (-g and using declaration causing ICE in reference_to_unused) X-Git-Tag: prereleases/gcc-4.2.3-rc1~202 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e85a7daad64c8a6615691c51c46fdc52ce61cae5;p=thirdparty%2Fgcc.git backport: re PR debug/31899 (-g and using declaration causing ICE in reference_to_unused) 2007-10-10 Richard Guenther Backport from mainline 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. From-SVN: r129199 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 5d85ecea41f2..6e66ce47447c 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +2007-10-10 Richard Guenther + + Backport from mainline + 2007-10-03 Doug Kwan + Richard Guenther + + PR debug/31899 + * dwarf2out.c (reference_to_unused): Disable sanity checking, + be conservative instead. + 2007-10-10 Richard Guenther PR tree-optimization/33099 diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 2d8932ae358f..5a3a2a3de4be 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -10005,9 +10005,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 cgraph_varpool_node *node = cgraph_varpool_node (*tp); diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 4ddcfea428c2..c6ad1cb32b5d 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,12 @@ +2007-10-10 Richard Guenther + + Backport from mainline + 2007-10-03 Doug Kwan + Richard Guenther + + PR debug/31899 + * g++.dg/debug/using3.C: New testcase. + 2007-10-10 Richard Guenther PR tree-optimization/33099 diff --git a/gcc/testsuite/g++.dg/debug/using3.C b/gcc/testsuite/g++.dg/debug/using3.C new file mode 100644 index 000000000000..df3e3dfa3a18 --- /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;