diff options
author | Eric Botcazou <ebotcazou@adacore.com> | 2024-01-12 10:50:01 +0100 |
---|---|---|
committer | Marc Poulhiès <poulhies@adacore.com> | 2024-05-21 09:26:49 +0200 |
commit | 0967e06caaa606eec7b2f222bb9926ec6523ea02 (patch) | |
tree | cf89500112dd6d5684dd27bb4c4b9d9d0276c2cc | |
parent | dc775b12224ca18088b5f6a8a7759c426a58b116 (diff) | |
download | gcc-0967e06caaa606eec7b2f222bb9926ec6523ea02.zip gcc-0967e06caaa606eec7b2f222bb9926ec6523ea02.tar.gz gcc-0967e06caaa606eec7b2f222bb9926ec6523ea02.tar.bz2 |
ada: Fix crash on aliased constant with packed array type and -g switch
The problem is that we build a template whose array field is not an array
in the case of an aliased object with nominal unconstrained array subtype.
gcc/ada/
* gcc-interface/decl.cc (gnat_to_gnu_entity) <E_Variable>: For an
array allocated with its bounds, make sure to have an array type
to build the template.
-rw-r--r-- | gcc/ada/gcc-interface/decl.cc | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/gcc/ada/gcc-interface/decl.cc b/gcc/ada/gcc-interface/decl.cc index ca174bf..41d5c29 100644 --- a/gcc/ada/gcc-interface/decl.cc +++ b/gcc/ada/gcc-interface/decl.cc @@ -939,6 +939,9 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition) && !type_annotate_only) { tree gnu_array = gnat_to_gnu_type (Base_Type (gnat_type)); + /* Make sure to have an array type for the template. */ + if (TYPE_IS_PADDING_P (gnu_type)) + gnu_type = TREE_TYPE (TYPE_FIELDS (gnu_type)); gnu_type = build_unc_object_type_from_ptr (TREE_TYPE (gnu_array), gnu_type, |