* Re: Fix PR48703: segfault in mangler due to -g
@ 2011-04-20 23:38 Michael Matz
2011-04-21 9:27 ` Richard Guenther
0 siblings, 1 reply; 3+ messages in thread
From: Michael Matz @ 2011-04-20 23:38 UTC (permalink / raw)
To: gcc-patches
Hi,
I wrote:
> Basically we have to set assembler names early also for TYPE_DECLs, we
> can't rely on the frontends langhook to do that after free_lang_data.
>
> Okay for trunk assuming regstrapping on x86_64-linux works?
Patch retracted, doesn't even survive testsuite. The problem is that we
can't simply accept TYPE_DECLs for generating assembler names, because the
other frontends except C++ can't deal with that (they use the default
set_decl_assembler_name hook). Even conditionalizing on
lang_hooks.set_decl_assembler_name == lhd_set_decl_assembler_name
doesn't work, because mysteriously for C++ we'll get ICEs in the C++
frontend itself when presented to mangle some TYPE_DECLs (namely when
flag_abi_version is set, mangle_decl unconditionally calls make_alias_for,
which in turn doesn't work with type_decls).
It's all quite messy and a wonder why -g worked somewhat with -flto at all
for so long :-(
Ciao,
Michael.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Fix PR48703: segfault in mangler due to -g
2011-04-20 23:38 Fix PR48703: segfault in mangler due to -g Michael Matz
@ 2011-04-21 9:27 ` Richard Guenther
0 siblings, 0 replies; 3+ messages in thread
From: Richard Guenther @ 2011-04-21 9:27 UTC (permalink / raw)
To: Michael Matz; +Cc: gcc-patches
On Thu, Apr 21, 2011 at 12:04 AM, Michael Matz <matz@suse.de> wrote:
> Hi,
>
> I wrote:
>
>> Basically we have to set assembler names early also for TYPE_DECLs, we
>> can't rely on the frontends langhook to do that after free_lang_data.
>>
>> Okay for trunk assuming regstrapping on x86_64-linux works?
>
> Patch retracted, doesn't even survive testsuite. The problem is that we
> can't simply accept TYPE_DECLs for generating assembler names, because the
> other frontends except C++ can't deal with that (they use the default
> set_decl_assembler_name hook). Even conditionalizing on
> lang_hooks.set_decl_assembler_name == lhd_set_decl_assembler_name
> doesn't work, because mysteriously for C++ we'll get ICEs in the C++
> frontend itself when presented to mangle some TYPE_DECLs (namely when
> flag_abi_version is set, mangle_decl unconditionally calls make_alias_for,
> which in turn doesn't work with type_decls).
>
> It's all quite messy and a wonder why -g worked somewhat with -flto at all
> for so long :-(
It's indeed messy ;)
An alternate fix would be to have a gimple_decl_assembler_name, and
reset the langhook to that variant. I'm testing a patch according to that.
Richard.
>
> Ciao,
> Michael.
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Fix PR48703: segfault in mangler due to -g
@ 2011-04-20 16:35 Michael Matz
0 siblings, 0 replies; 3+ messages in thread
From: Michael Matz @ 2011-04-20 16:35 UTC (permalink / raw)
To: gcc-patches
Hi,
as noted in the bug trail the fix for PR48207 broke compilation of C++
programs with -g. This variant fixes the bug too without breaking -g.
Basically we have to set assembler names early also for TYPE_DECLs, we
can't rely on the frontends langhook to do that after free_lang_data.
Okay for trunk assuming regstrapping on x86_64-linux works?
Ciao,
Michael.
------------------------
PR debug/48703
* dwarf2out.c (retry_incomplete_types): Export. Clear
incomplete_types.
* dwarf2out.h (retry_incomplete_types): Declare.
* tree.c (need_assembler_name_p): Also handle TYPE_DECLs.
(free_lang_data_in_cgraph): Call retry_incomplete_types.
(free_lang_data): Reset set_decl_assembler_name langhook.
* Makefile.in (tree.o): Depend on dwarf2out.h.
Index: tree.c
===================================================================
--- tree.c (revision 172769)
+++ tree.c (working copy)
@@ -61,6 +61,7 @@ along with GCC; see the file COPYING3.
#include "except.h"
#include "debug.h"
#include "intl.h"
+#include "dwarf2out.h"
/* Tree code classes. */
@@ -4500,7 +4501,8 @@ need_assembler_name_p (tree decl)
{
/* Only FUNCTION_DECLs and VAR_DECLs are considered. */
if (TREE_CODE (decl) != FUNCTION_DECL
- && TREE_CODE (decl) != VAR_DECL)
+ && TREE_CODE (decl) != VAR_DECL
+ && TREE_CODE (decl) != TYPE_DECL)
return false;
/* If DECL already has its assembler name set, it does not need a
@@ -4538,6 +4540,11 @@ need_assembler_name_p (tree decl)
return false;
}
+ if (TREE_CODE (decl) == TYPE_DECL)
+ {
+ if (TYPE_DECL_SUPPRESS_DEBUG (decl))
+ return false;
+ }
return true;
}
@@ -5111,6 +5118,8 @@ free_lang_data_in_cgraph (void)
FOR_EACH_VEC_ELT (tree, fld.decls, i, t)
assign_assembler_name_if_neeeded (t);
+ retry_incomplete_types ();
+
/* Traverse every decl found freeing its language data. */
FOR_EACH_VEC_ELT (tree, fld.decls, i, t)
free_lang_data_in_decl (t);
@@ -5182,6 +5191,7 @@ free_lang_data (void)
name and only produce assembler names for local symbols. Or rather
make sure we never call decl_assembler_name on local symbols and
devise a separate, middle-end private scheme for it. */
+ lang_hooks.set_decl_assembler_name = lhd_set_decl_assembler_name;
/* Reset diagnostic machinery. */
diagnostic_starter (global_dc) = default_tree_diagnostic_starter;
Index: dwarf2out.c
===================================================================
--- dwarf2out.c (revision 172769)
+++ dwarf2out.c (working copy)
@@ -6575,7 +6575,6 @@ static dw_die_ref force_type_die (tree);
static dw_die_ref setup_namespace_context (tree, dw_die_ref);
static dw_die_ref declare_in_namespace (tree, dw_die_ref);
static struct dwarf_file_data * lookup_filename (const char *);
-static void retry_incomplete_types (void);
static void gen_type_die_for_member (tree, tree, dw_die_ref);
static void gen_generic_params_dies (tree);
static void gen_tagged_type_die (tree, dw_die_ref, enum debug_info_usage);
@@ -18497,15 +18496,17 @@ gen_entry_point_die (tree decl, dw_die_r
/* Walk through the list of incomplete types again, trying once more to
emit full debugging info for them. */
-static void
+void
retry_incomplete_types (void)
{
int i;
-
- for (i = VEC_length (tree, incomplete_types) - 1; i >= 0; i--)
- if (should_emit_struct_debug (VEC_index (tree, incomplete_types, i),
+ VEC(tree,gc) *types = incomplete_types;
+ incomplete_types = NULL;
+ for (i = VEC_length (tree, types) - 1; i >= 0; i--)
+ if (should_emit_struct_debug (VEC_index (tree, types, i),
DINFO_USAGE_DIR_USE))
- gen_type_die (VEC_index (tree, incomplete_types, i), comp_unit_die ());
+ gen_type_die (VEC_index (tree, types, i), comp_unit_die ());
+ types = NULL;
}
/* Determine what tag to use for a record type. */
Index: dwarf2out.h
===================================================================
--- dwarf2out.h (revision 172769)
+++ dwarf2out.h (working copy)
@@ -25,6 +25,8 @@ extern void dwarf2out_cfi_begin_epilogue
extern void dwarf2out_frame_debug_restore_state (void);
extern void dwarf2out_flush_queued_reg_saves (void);
+extern void retry_incomplete_types (void);
+
extern void debug_dwarf (void);
struct die_struct;
extern void debug_dwarf_die (struct die_struct *);
Index: Makefile.in
===================================================================
--- Makefile.in (revision 172769)
+++ Makefile.in (working copy)
@@ -2354,7 +2354,7 @@ langhooks.o : langhooks.c $(CONFIG_H) $(
tree.o: tree.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
all-tree.def $(FLAGS_H) $(FUNCTION_H) $(PARAMS_H) \
toplev.h $(DIAGNOSTIC_CORE_H) $(GGC_H) $(HASHTAB_H) $(TARGET_H) output.h $(TM_P_H) \
- langhooks.h gt-tree.h $(TREE_INLINE_H) tree-iterator.h \
+ langhooks.h gt-tree.h $(TREE_INLINE_H) tree-iterator.h dwarf2out.h \
$(BASIC_BLOCK_H) $(TREE_FLOW_H) $(OBSTACK_H) pointer-set.h \
tree-pass.h $(LANGHOOKS_DEF_H) $(DIAGNOSTIC_H) $(CGRAPH_H) $(TIMEVAR_H) \
$(EXCEPT_H) debug.h intl.h tree-diagnostic.h tree-pretty-print.h
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2011-04-21 9:02 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-04-20 23:38 Fix PR48703: segfault in mangler due to -g Michael Matz
2011-04-21 9:27 ` Richard Guenther
-- strict thread matches above, loose matches on Subject: below --
2011-04-20 16:35 Michael Matz
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).