aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/gcc-interface/decl.cc
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2023-12-12 10:17:19 +0100
committerMarc Poulhiès <poulhies@adacore.com>2024-01-09 14:13:32 +0100
commitbcf7ebba9115cc1e0e1be4c6e00728e0e99e5fc8 (patch)
tree53a8c6b636bf13ceaa1df580960f8689868f86d4 /gcc/ada/gcc-interface/decl.cc
parent63da219a948a4d9f98f5a0d23e9c19fe48bc0734 (diff)
downloadgcc-bcf7ebba9115cc1e0e1be4c6e00728e0e99e5fc8.zip
gcc-bcf7ebba9115cc1e0e1be4c6e00728e0e99e5fc8.tar.gz
gcc-bcf7ebba9115cc1e0e1be4c6e00728e0e99e5fc8.tar.bz2
ada: Fix bogus Constraint_Error on allocator for access to array of access type
This occurs because the access element type is not its own TYPE_CANONICAL, which creates a discrepancy between the aliasing support code, which deals with types directly, and the middle-end which looks at TYPE_CANONICAL only. gcc/ada/ * gcc-interface/decl.cc (gnat_to_gnu_entity) <E_Array_Type>: Use the TYPE_CANONICAL of types when it comes to aliasing. * gcc-interface/utils.cc (relate_alias_sets): Likewise.
Diffstat (limited to 'gcc/ada/gcc-interface/decl.cc')
-rw-r--r--gcc/ada/gcc-interface/decl.cc6
1 files changed, 3 insertions, 3 deletions
diff --git a/gcc/ada/gcc-interface/decl.cc b/gcc/ada/gcc-interface/decl.cc
index 221baeb..93cfcb7 100644
--- a/gcc/ada/gcc-interface/decl.cc
+++ b/gcc/ada/gcc-interface/decl.cc
@@ -2185,8 +2185,8 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition)
if (COMPLETE_TYPE_P (gnu_fat_type))
{
fld = TYPE_FIELDS (gnu_fat_type);
- if (TYPE_ALIAS_SET_KNOWN_P (TREE_TYPE (fld)))
- ptr_set = TYPE_ALIAS_SET (TREE_TYPE (fld));
+ if (TYPE_ALIAS_SET_KNOWN_P (TYPE_CANONICAL (TREE_TYPE (fld))))
+ ptr_set = TYPE_ALIAS_SET (TYPE_CANONICAL (TREE_TYPE (fld)));
TREE_TYPE (fld) = ptr_type_node;
TREE_TYPE (DECL_CHAIN (fld)) = gnu_ptr_template;
TYPE_DECL_SUPPRESS_DEBUG (TYPE_STUB_DECL (gnu_fat_type)) = 0;
@@ -2417,7 +2417,7 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition)
else
TREE_TYPE (fld) = build_pointer_type (tem);
if (ptr_set != -1)
- TYPE_ALIAS_SET (TREE_TYPE (fld)) = ptr_set;
+ TYPE_ALIAS_SET (TYPE_CANONICAL (TREE_TYPE (fld))) = ptr_set;
/* If the maximum size doesn't overflow, use it. */
if (gnu_max_size