[Bug debug/96690] [10/11 Regression] ICE in write_type since r10-6087
rguenth at gcc dot gnu.org
gcc-bugzilla@gcc.gnu.org
Mon Aug 24 11:51:31 GMT 2020
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96690
--- Comment #5 from Richard Biener <rguenth at gcc dot gnu.org> ---
Forcing the mangling via generating garbage RTL early doesn't work since
the
/* ??? The C++ FE emits debug information for using decls, so
putting gcc_unreachable here falls over. See PR31899. For now
be conservative. */
else if (!symtab->global_info_ready && VAR_OR_FUNCTION_DECL_P (*tp))
return *tp;
check in reference_to_unused triggers during the early debug pass over
template params and thus no RTL is generated from there. But the late
pass looks phishy:
else if (TREE_CODE (*tp) == FUNCTION_DECL
&& (!DECL_EXTERNAL (*tp) || DECL_DECLARED_INLINE_P (*tp)))
{
/* The call graph machinery must have finished analyzing,
optimizing and gimplifying the CU by now.
So if *TP has no call graph node associated
to it, it means *TP will not be emitted. */
if (!cgraph_node::get (*tp))
return *tp;
but 'foo' is DECL_EXTERNAL and TREE_PUBLIC. The following works on this
testcase though:
diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c
index 9deca031fc2..29e011a296d 100644
--- a/gcc/dwarf2out.c
+++ b/gcc/dwarf2out.c
@@ -19756,7 +19785,7 @@ reference_to_unused (tree * tp, int * walk_subtrees,
/* ??? The C++ FE emits debug information for using decls, so
putting gcc_unreachable here falls over. See PR31899. For now
be conservative. */
- else if (!symtab->global_info_ready && VAR_OR_FUNCTION_DECL_P (*tp))
+ else if (!symtab->global_info_ready && VAR_P (*tp))
return *tp;
else if (VAR_P (*tp))
{
@@ -19771,7 +19800,7 @@ reference_to_unused (tree * tp, int * walk_subtrees,
optimizing and gimplifying the CU by now.
So if *TP has no call graph node associated
to it, it means *TP will not be emitted. */
- if (!cgraph_node::get (*tp))
+ if (!symtab->global_info_ready || !cgraph_node::get (*tp))
return *tp;
}
else if (TREE_CODE (*tp) == STRING_CST && !TREE_ASM_WRITTEN (*tp))
@@ -20295,12 +20324,11 @@ tree_add_const_value_attribute (dw_die_ref die, tree
t)
return true;
}
}
- if (! early_dwarf)
- {
- rtl = rtl_for_decl_init (init, type);
- if (rtl)
- return add_const_value_attribute (die, rtl);
- }
+ /* Generate the RTL even if early_dwarf to force mangling of all refered to
+ symbols. */
+ rtl = rtl_for_decl_init (init, type);
+ if (rtl && !early_dwarf)
+ return add_const_value_attribute (die, rtl);
/* If the host and target are sane, try harder. */
if (CHAR_BIT == 8 && BITS_PER_UNIT == 8
&& initializer_constant_valid_p (init, type))
More information about the Gcc-bugs
mailing list