From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1285) id F20BA385842B; Tue, 14 Sep 2021 08:47:30 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org F20BA385842B MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Eric Botcazou To: gcc-cvs@gcc.gnu.org Subject: [gcc r10-10120] Fix internal error on pointer-to-pointer binding in LTO mode X-Act-Checkin: gcc X-Git-Author: Eric Botcazou X-Git-Refname: refs/heads/releases/gcc-10 X-Git-Oldrev: 2290a4047010bf1642035f4d88e8baf6a7604aee X-Git-Newrev: bc4cc866114553ad0f487f83bc2cbfc85c88e92d Message-Id: <20210914084730.F20BA385842B@sourceware.org> Date: Tue, 14 Sep 2021 08:47:30 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 14 Sep 2021 08:47:31 -0000 https://gcc.gnu.org/g:bc4cc866114553ad0f487f83bc2cbfc85c88e92d commit r10-10120-gbc4cc866114553ad0f487f83bc2cbfc85c88e92d Author: Eric Botcazou Date: Tue Sep 14 10:44:34 2021 +0200 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. Diff: --- gcc/ada/gcc-interface/utils.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/gcc/ada/gcc-interface/utils.c b/gcc/ada/gcc-interface/utils.c index 3dcdbb88703..db78c6e8eb3 100644 --- a/gcc/ada/gcc-interface/utils.c +++ b/gcc/ada/gcc-interface/utils.c @@ -4230,6 +4230,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. */ @@ -4246,7 +4247,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;