aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/gcc-interface/decl.cc
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2023-10-17 19:20:26 +0200
committerMarc Poulhiès <poulhies@adacore.com>2023-11-07 10:15:05 +0100
commitb6ba22cab4fdea3468896c37719c0b9e946a646f (patch)
treea8af24b7a0ccdf8cbc11f016d9a81cb45c2d08ab /gcc/ada/gcc-interface/decl.cc
parentc210397b75df066ef96c6834a0d4273658d07ee7 (diff)
downloadgcc-b6ba22cab4fdea3468896c37719c0b9e946a646f.zip
gcc-b6ba22cab4fdea3468896c37719c0b9e946a646f.tar.gz
gcc-b6ba22cab4fdea3468896c37719c0b9e946a646f.tar.bz2
ada: Fix debug info for aliased packed array with unconstrained nominal subtype
The front-end now rewrites it as a renaming when it is initialized with a function call and the same processing must be applied in the renaming case as in the regular case for this kind of special objects. gcc/ada/ * gcc-interface/decl.cc (gnat_to_gnu_entity) <E_Variable>: Apply the specific rewriting done for an aliased object with an unconstrained array nominal subtype in the renaming case too.
Diffstat (limited to 'gcc/ada/gcc-interface/decl.cc')
-rw-r--r--gcc/ada/gcc-interface/decl.cc12
1 files changed, 12 insertions, 0 deletions
diff --git a/gcc/ada/gcc-interface/decl.cc b/gcc/ada/gcc-interface/decl.cc
index 20ab185..95fa508 100644
--- a/gcc/ada/gcc-interface/decl.cc
+++ b/gcc/ada/gcc-interface/decl.cc
@@ -1145,6 +1145,18 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition)
the entity as indirect reference to the renamed object. */
if (Materialize_Entity (gnat_entity))
{
+ /* If this is an aliased object with an unconstrained array
+ nominal subtype, we make its type a thin reference, i.e.
+ the reference counterpart of a thin pointer, exactly as
+ we would have done in the non-renaming case below. */
+ if (Is_Constr_Subt_For_UN_Aliased (gnat_type)
+ && Is_Array_Type (gnat_und_type)
+ && !type_annotate_only)
+ {
+ tree gnu_array
+ = gnat_to_gnu_type (Base_Type (gnat_type));
+ gnu_type = TYPE_OBJECT_RECORD_TYPE (gnu_array);
+ }
gnu_type = build_reference_type (gnu_type);
const_flag = true;
volatile_flag = false;