From: Eric Botcazou Date: Tue, 14 Sep 2021 09:10:17 +0000 (+0200) Subject: Fix inaccurate bounds in debug info for vector array types X-Git-Tag: releases/gcc-11.3.0~904 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=1355ea504983c04bbf44e01f63d1059f3df0ad7a;p=thirdparty%2Fgcc.git 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 --git a/gcc/ada/gcc-interface/decl.c b/gcc/ada/gcc-interface/decl.c index d901529fd242..c71d0d6f396f 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. */