From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id C71B738654B5; Wed, 29 May 2024 12:08:36 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C71B738654B5 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1716984516; bh=OJ2jvf2MVeTn/FhEhUGFotnOx8wFOuDqMQqu84UxHUc=; h=From:To:Subject:Date:In-Reply-To:References:From; b=ev9pXiKRX6Nt+x6tCJAWYRIzayPumuFVgzu3+CykZARClR7gKYp/4kd/W6x0DvzcD UunBNIL7+sA3D3ecXEZKSaUbSFdSc+tvg9UhXLiNRo4izsP3GRyUl6MY3zqZRJZN2X EdoU7Qq/PG9xlzFhMpMZoMItgDV+bxWwy25CJv6I= From: "vries at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug debug/115272] [debug] complex type is hard to related back to base type Date: Wed, 29 May 2024 12:08:36 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: debug X-Bugzilla-Version: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: vries at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D115272 --- Comment #4 from Tom de Vries --- With this patch: ... diff --git a/gcc/dwarf2out.cc b/gcc/dwarf2out.cc index 8ec3856873e..ea3318396e0 100644 --- a/gcc/dwarf2out.cc +++ b/gcc/dwarf2out.cc @@ -13247,6 +13247,7 @@ base_type_die (tree type, bool reverse) bool fpt_used =3D false; struct fixed_point_type_info fpt_info; tree type_bias =3D NULL_TREE; + tree type_attr =3D NULL_TREE; /* If this is a subtype that should not be emitted as a subrange type, use the base type. See subrange_type_for_debug_p. */ @@ -13342,6 +13343,8 @@ base_type_die (tree type, bool reverse) } else encoding =3D DW_ATE_lo_user; + if (!dwarf_strict) + type_attr =3D TREE_TYPE (type); break; case BOOLEAN_TYPE: @@ -13421,6 +13424,13 @@ base_type_die (tree type, bool reverse) | dw_scalar_form_reference, NULL); + if (type_attr !=3D NULL_TREE) + { + dw_die_ref type_attr_die + =3D modified_type_die (type_attr, 0, reverse, comp_unit_die ()); + add_AT_die_ref (base_type_result, DW_AT_type, type_attr_die); + } + return base_type_result; } ... on x86_64 we get: ... <1><32>: Abbrev Number: 2 (DW_TAG_base_type) <33> DW_AT_byte_size : 4 <34> DW_AT_encoding : 4 (float) <34> DW_AT_name : float <1><38>: Abbrev Number: 3 (DW_TAG_base_type) <39> DW_AT_byte_size : 8 <3a> DW_AT_encoding : 3 (complex float) <3a> DW_AT_type : <0x32> <3e> DW_AT_name : complex float <1><56>: Abbrev Number: 2 (DW_TAG_base_type) <57> DW_AT_byte_size : 8 <58> DW_AT_encoding : 4 (float) <58> DW_AT_name : double <1><5c>: Abbrev Number: 3 (DW_TAG_base_type) <5d> DW_AT_byte_size : 16 <5e> DW_AT_encoding : 3 (complex float) <5e> DW_AT_type : <0x56> <62> DW_AT_name : complex double <1><7b>: Abbrev Number: 2 (DW_TAG_base_type) <7c> DW_AT_byte_size : 16 <7d> DW_AT_encoding : 4 (float) <7d> DW_AT_name : long double <1><81>: Abbrev Number: 3 (DW_TAG_base_type) <82> DW_AT_byte_size : 32 <83> DW_AT_encoding : 3 (complex float) <83> DW_AT_type : <0x7b> <87> DW_AT_name : complex long double ...=