From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1285) id 16E2D3858282; Mon, 4 Jul 2022 10:23:56 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 16E2D3858282 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 r13-1454] Use default lower bound for vector types in debug info X-Act-Checkin: gcc X-Git-Author: Eric Botcazou X-Git-Refname: refs/heads/master X-Git-Oldrev: a7ccdfa17e5c45c32828fbeb3642ccdb10caa141 X-Git-Newrev: 483bd9a02831d9cb615179e5758946f41622d6c9 Message-Id: <20220704102356.16E2D3858282@sourceware.org> Date: Mon, 4 Jul 2022 10:23:56 +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, 04 Jul 2022 10:23:56 -0000 https://gcc.gnu.org/g:483bd9a02831d9cb615179e5758946f41622d6c9 commit r13-1454-g483bd9a02831d9cb615179e5758946f41622d6c9 Author: Eric Botcazou Date: Mon Jul 4 12:14:03 2022 +0200 Use default lower bound for vector types in debug info Vector types are represented as array types with DW_AT_GNU_vector attribute in the debug info and a range [0 .. TYPE_VECTOR_SUBPARTS - 1]. Now that's obviously skewed toward the C family of languages, therefore the attached patch changes the lower bound to the default for the language of the CU. gcc/ * dwarf2out.cc (gen_array_type_die): Use the default lower bound of the language for vector types. Diff: --- gcc/dwarf2out.cc | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/gcc/dwarf2out.cc b/gcc/dwarf2out.cc index b468a4b9c0f..e3920c898f5 100644 --- a/gcc/dwarf2out.cc +++ b/gcc/dwarf2out.cc @@ -22539,11 +22539,14 @@ gen_array_type_die (tree type, dw_die_ref context_die) if (TREE_CODE (type) == VECTOR_TYPE) { - /* For VECTOR_TYPEs we use an array die with appropriate bounds. */ + /* For VECTOR_TYPEs we use an array DIE with appropriate bounds. */ dw_die_ref subrange_die = new_die (DW_TAG_subrange_type, array_die, NULL); - add_bound_info (subrange_die, DW_AT_lower_bound, size_zero_node, NULL); + int lb = lower_bound_default (); + if (lb == -1) + lb = 0; + add_bound_info (subrange_die, DW_AT_lower_bound, size_int (lb), NULL); add_bound_info (subrange_die, DW_AT_upper_bound, - size_int (TYPE_VECTOR_SUBPARTS (type) - 1), NULL); + size_int (lb + TYPE_VECTOR_SUBPARTS (type) - 1), NULL); } else add_subscript_info (array_die, type, collapse_nested_arrays);