aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/gcc-interface/utils.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/utils.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/utils.cc')
-rw-r--r--gcc/ada/gcc-interface/utils.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/gcc/ada/gcc-interface/utils.cc b/gcc/ada/gcc-interface/utils.cc
index bc063c2..b3aae5b 100644
--- a/gcc/ada/gcc-interface/utils.cc
+++ b/gcc/ada/gcc-interface/utils.cc
@@ -1867,7 +1867,8 @@ relate_alias_sets (tree new_type, tree old_type, enum alias_set_op op)
&& TYPE_NONALIASED_COMPONENT (new_type)
!= TYPE_NONALIASED_COMPONENT (old_type)));
- TYPE_ALIAS_SET (new_type) = get_alias_set (old_type);
+ /* The alias set always lives on the TYPE_CANONICAL. */
+ TYPE_ALIAS_SET (TYPE_CANONICAL (new_type)) = get_alias_set (old_type);
break;
case ALIAS_SET_SUBSET: