This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Candidate fix for g++.dg/bprob.exp regressions
- From: Zack Weinberg <zack at codesourcery dot com>
- To: gcc-patches at gcc dot gnu dot org
- Cc: Gabriel Dos Reis <gdr at integrable-solutions dot net>
- Date: Sun, 28 Mar 2004 10:11:58 -0800
- Subject: Candidate fix for g++.dg/bprob.exp regressions
This is a candidate fix for the g++.dg/bprob.exp regression produced
by my c-decl.c rewrite. They are a three-way interaction effect.
coverage.c no longer calls pushdecl on its synthetic functions, so
they do not get a lang_specific structure attached to them. But we
still (correctly) try to put out debug info for them. dwarf2out.c
calls lang_hooks.decl_name to get the name of the decl for the debug
info. In C++, that reuses the machinery for error message printing,
dump_function_name. And that crashes if fed a declaration without a
lang_specific structure.
My fix is to make dump_function_name do something sensible instead of
crashing. It might be preferable to address this by not using
lang_hooks.decl_name for anything but diagnostics; I don't know, nor
do I know what dwarf2out.c should do instead. Anyway, this makes the
regressions go away; i686-linux bootstrap in progress, but I will wait
for comments before checking anything in. cc:ing Gaby since he owns
the C++ diagnostic printer.
Is there a PR for this regression?
zw
cp:
* error.c (dump_function_name): If T's DECL_LANG_SPECIFIC
is null, just print the literal name and return.
===================================================================
Index: cp/error.c
--- cp/error.c 21 Mar 2004 23:55:02 -0000 1.248
+++ cp/error.c 28 Mar 2004 18:09:11 -0000
@@ -1134,6 +1134,17 @@ dump_function_name (tree t, int flags)
{
tree name = DECL_NAME (t);
+ /* We can get here with a decl that was synthesized by language-
+ independent machinery (e.g. coverage.c) in which case it won't
+ have a lang_specific structure attached and DECL_CONSTRUCTOR_P
+ will crash. In this case it is safe just to print out the
+ literal name. */
+ if (!DECL_LANG_SPECIFIC (t))
+ {
+ pp_tree_identifier (cxx_pp, name);
+ return;
+ }
+
if (TREE_CODE (t) == TEMPLATE_DECL)
t = DECL_TEMPLATE_RESULT (t);
@@ -1163,7 +1174,7 @@ dump_function_name (tree t, int flags)
else
dump_decl (name, flags);
- if (DECL_LANG_SPECIFIC (t) && DECL_TEMPLATE_INFO (t)
+ if (DECL_TEMPLATE_INFO (t)
&& !DECL_FRIEND_PSEUDO_TEMPLATE_INSTANTIATION (t)
&& (DECL_TEMPLATE_SPECIALIZATION (t)
|| TREE_CODE (DECL_TI_TEMPLATE (t)) != TEMPLATE_DECL