aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/gcc-interface/utils.c
diff options
context:
space:
mode:
authorEric Botcazou <ebotcazou@adacore.com>2021-09-14 10:44:34 +0200
committerEric Botcazou <ebotcazou@adacore.com>2021-09-14 10:45:35 +0200
commitcaef5203d64e61da506909d58890035af32a6239 (patch)
tree7e13c5976665587832f7b7a7383aed7d0aa064b6 /gcc/ada/gcc-interface/utils.c
parentb29fc21482c0e203136eb5d44bdc1495de3918c6 (diff)
downloadgcc-caef5203d64e61da506909d58890035af32a6239.zip
gcc-caef5203d64e61da506909d58890035af32a6239.tar.gz
gcc-caef5203d64e61da506909d58890035af32a6239.tar.bz2
Fix internal error on pointer-to-pointer binding in LTO mode
gcc/ada/ * gcc-interface/utils.c (update_pointer_to): Set TYPE_CANONICAL on pointer and reference types.
Diffstat (limited to 'gcc/ada/gcc-interface/utils.c')
-rw-r--r--gcc/ada/gcc-interface/utils.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/gcc/ada/gcc-interface/utils.c b/gcc/ada/gcc-interface/utils.c
index 04179df..4190855 100644
--- a/gcc/ada/gcc-interface/utils.c
+++ b/gcc/ada/gcc-interface/utils.c
@@ -4329,6 +4329,7 @@ update_pointer_to (tree old_type, tree new_type)
TREE_TYPE (t) = new_type;
if (TYPE_NULL_BOUNDS (t))
TREE_TYPE (TREE_OPERAND (TYPE_NULL_BOUNDS (t), 0)) = new_type;
+ TYPE_CANONICAL (t) = TYPE_CANONICAL (TYPE_POINTER_TO (new_type));
}
/* Chain REF and its variants at the end. */
@@ -4345,7 +4346,10 @@ update_pointer_to (tree old_type, tree new_type)
/* Now adjust them. */
for (; ref; ref = TYPE_NEXT_REF_TO (ref))
for (t = TYPE_MAIN_VARIANT (ref); t; t = TYPE_NEXT_VARIANT (t))
- TREE_TYPE (t) = new_type;
+ {
+ TREE_TYPE (t) = new_type;
+ TYPE_CANONICAL (t) = TYPE_CANONICAL (TYPE_REFERENCE_TO (new_type));
+ }
TYPE_POINTER_TO (old_type) = NULL_TREE;
TYPE_REFERENCE_TO (old_type) = NULL_TREE;