public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r14-5546] Assert we don't create recursive DW_AT_{abstract_origin, specification}
@ 2023-11-17 7:54 Richard Biener
0 siblings, 0 replies; only message in thread
From: Richard Biener @ 2023-11-17 7:54 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:1bcb7fe60544bba8b88028f9ffa062336d399664
commit r14-5546-g1bcb7fe60544bba8b88028f9ffa062336d399664
Author: Richard Biener <rguenther@suse.de>
Date: Mon Oct 30 13:17:11 2023 +0100
Assert we don't create recursive DW_AT_{abstract_origin,specification}
We have a support case that shows GCC 7 sometimes creates
DW_TAG_label refering to itself via a DW_AT_abstract_origin
when using LTO. This for example triggers the sanity check
added below during LTO bootstrap.
Making this check cover more than just DW_AT_abstract_origin
breaks bootstrap on trunk for
/* GNU extension: Record what type our vtable lives in. */
if (TYPE_VFIELD (type))
{
tree vtype = DECL_FCONTEXT (TYPE_VFIELD (type));
gen_type_die (vtype, context_die);
add_AT_die_ref (type_die, DW_AT_containing_type,
lookup_type_die (vtype));
so the check is for now restricted to DW_AT_abstract_origin
and DW_AT_specification both of which we follow within get_AT.
* dwarf2out.cc (add_AT_die_ref): Assert we do not add
a self-ref DW_AT_abstract_origin or DW_AT_specification.
Diff:
---
gcc/dwarf2out.cc | 3 +++
1 file changed, 3 insertions(+)
diff --git a/gcc/dwarf2out.cc b/gcc/dwarf2out.cc
index 9850d094707..d187be9b786 100644
--- a/gcc/dwarf2out.cc
+++ b/gcc/dwarf2out.cc
@@ -4908,6 +4908,9 @@ add_AT_die_ref (dw_die_ref die, enum dwarf_attribute attr_kind, dw_die_ref targ_
{
dw_attr_node attr;
gcc_checking_assert (targ_die != NULL);
+ gcc_assert (targ_die != die
+ || (attr_kind != DW_AT_abstract_origin
+ && attr_kind != DW_AT_specification));
/* With LTO we can end up trying to reference something we didn't create
a DIE for. Avoid crashing later on a NULL referenced DIE. */
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2023-11-17 7:54 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-11-17 7:54 [gcc r14-5546] Assert we don't create recursive DW_AT_{abstract_origin, specification} Richard Biener
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).