From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1285) id 146C13947C00; Mon, 16 Aug 2021 13:29:12 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 146C13947C00 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Eric Botcazou To: gcc-cvs@gcc.gnu.org Subject: [gcc r11-8871] Fix regression in debug info for Ada with DWARF 5 X-Act-Checkin: gcc X-Git-Author: Eric Botcazou X-Git-Refname: refs/heads/releases/gcc-11 X-Git-Oldrev: 64336a85c96ef91f863bd8e86aa5002c3c69f386 X-Git-Newrev: 0c0c320a6e6195e68a4e0e44378ccde3be2d998b Message-Id: <20210816132912.146C13947C00@sourceware.org> Date: Mon, 16 Aug 2021 13:29:12 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 16 Aug 2021 13:29:12 -0000 https://gcc.gnu.org/g:0c0c320a6e6195e68a4e0e44378ccde3be2d998b commit r11-8871-g0c0c320a6e6195e68a4e0e44378ccde3be2d998b Author: Eric Botcazou Date: Mon Aug 16 15:26:22 2021 +0200 Fix regression in debug info for Ada with DWARF 5 add_scalar_info can directly generate a reference to an existing DIE for a scalar attribute, e.g the upper bound of a VLA, but it does so only if this existing DIE has a location or is a constant: if (get_AT (decl_die, DW_AT_location) || get_AT (decl_die, DW_AT_data_member_location) || get_AT (decl_die, DW_AT_const_value)) Now, in DWARF 5, members of a structure that are bitfields no longer have a DW_AT_data_member_location but a DW_AT_data_bit_offset attribute instead, so the condition is bypassed. gcc/ * dwarf2out.c (add_scalar_info): Deal with DW_AT_data_bit_offset. Diff: --- gcc/dwarf2out.c | 1 + 1 file changed, 1 insertion(+) diff --git a/gcc/dwarf2out.c b/gcc/dwarf2out.c index 7606371296e..54c6c326d49 100644 --- a/gcc/dwarf2out.c +++ b/gcc/dwarf2out.c @@ -21054,6 +21054,7 @@ add_scalar_info (dw_die_ref die, enum dwarf_attribute attr, tree value, { if (get_AT (decl_die, DW_AT_location) || get_AT (decl_die, DW_AT_data_member_location) + || get_AT (decl_die, DW_AT_data_bit_offset) || get_AT (decl_die, DW_AT_const_value)) { add_AT_die_ref (die, attr, decl_die);