From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1285) id 7CA843858402; Tue, 14 Sep 2021 09:12:25 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7CA843858402 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-8989] Fix inaccurate bounds in debug info for vector array types X-Act-Checkin: gcc X-Git-Author: Eric Botcazou X-Git-Refname: refs/heads/releases/gcc-11 X-Git-Oldrev: e94730e51afdaf2d61c8c89c89c39453dee7c6de X-Git-Newrev: 1355ea504983c04bbf44e01f63d1059f3df0ad7a Message-Id: <20210914091225.7CA843858402@sourceware.org> Date: Tue, 14 Sep 2021 09:12:25 +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: Tue, 14 Sep 2021 09:12:25 -0000 https://gcc.gnu.org/g:1355ea504983c04bbf44e01f63d1059f3df0ad7a commit r11-8989-g1355ea504983c04bbf44e01f63d1059f3df0ad7a Author: Eric Botcazou Date: Tue Sep 14 11:10:17 2021 +0200 Fix inaccurate bounds in debug info for vector array types They should not be 0-based, unless the array type itself is. gcc/ada/ * gcc-interface/decl.c (gnat_to_gnu_entity): For vector types, make the representative array the debug type. Diff: --- gcc/ada/gcc-interface/decl.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c index d901529fd24..c71d0d6f396 100644 --- a/gcc/ada/gcc-interface/decl.c +++ b/gcc/ada/gcc-interface/decl.c @@ -4745,6 +4745,14 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition) else gnu_decl = create_type_decl (gnu_entity_name, gnu_type, artificial_p, debug_info_p, gnat_entity); + + /* For vector types, make the representative array the debug type. */ + if (VECTOR_TYPE_P (gnu_type)) + { + tree rep = TYPE_REPRESENTATIVE_ARRAY (gnu_type); + TYPE_NAME (rep) = DECL_NAME (gnu_decl); + SET_TYPE_DEBUG_TYPE (gnu_type, rep); + } } /* Otherwise, for a type reusing an existing DECL, back-annotate values. */