From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1285) id 1A9973858018; Tue, 14 Sep 2021 09:12:31 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1A9973858018 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 r10-10121] 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-10 X-Git-Oldrev: bc4cc866114553ad0f487f83bc2cbfc85c88e92d X-Git-Newrev: 1f17aab16b06846b2911179b0206fc2801cc0f47 Message-Id: <20210914091231.1A9973858018@sourceware.org> Date: Tue, 14 Sep 2021 09:12:31 +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:31 -0000 https://gcc.gnu.org/g:1f17aab16b06846b2911179b0206fc2801cc0f47 commit r10-10121-g1f17aab16b06846b2911179b0206fc2801cc0f47 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 efbcf70eadc..80107a69060 100644 --- a/gcc/ada/gcc-interface/decl.c +++ b/gcc/ada/gcc-interface/decl.c @@ -4707,6 +4707,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. */