From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1914) id 1322A3851ABE; Wed, 13 Jul 2022 10:04:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1322A3851ABE MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Pierre-Marie de Rodat To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-1673] [Ada] Fix internal error on comparison with access function parameter X-Act-Checkin: gcc X-Git-Author: Eric Botcazou X-Git-Refname: refs/heads/master X-Git-Oldrev: 2b8c12348da3eb770968b718a9ace9fb8fba246f X-Git-Newrev: d927cb527cb17547b24d2b52ddd29e8fad621a66 Message-Id: <20220713100413.1322A3851ABE@sourceware.org> Date: Wed, 13 Jul 2022 10:04:13 +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: Wed, 13 Jul 2022 10:04:13 -0000 https://gcc.gnu.org/g:d927cb527cb17547b24d2b52ddd29e8fad621a66 commit r13-1673-gd927cb527cb17547b24d2b52ddd29e8fad621a66 Author: Eric Botcazou Date: Wed Jun 22 20:20:06 2022 +0200 [Ada] Fix internal error on comparison with access function parameter It comes from an overzealous assertion. gcc/ada/ * gcc-interface/utils2.cc (build_binary_op) : Also accept pointer-to-function types that are not variant of each other. Diff: --- gcc/ada/gcc-interface/utils2.cc | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/gcc/ada/gcc-interface/utils2.cc b/gcc/ada/gcc-interface/utils2.cc index 0dcc9fff2a0..4dfe29dc7d9 100644 --- a/gcc/ada/gcc-interface/utils2.cc +++ b/gcc/ada/gcc-interface/utils2.cc @@ -1134,12 +1134,17 @@ build_binary_op (enum tree_code op_code, tree result_type, else if (POINTER_TYPE_P (left_base_type) && POINTER_TYPE_P (right_base_type)) { + tree left_ref_type = TREE_TYPE (left_base_type); + tree right_ref_type = TREE_TYPE (right_base_type); + /* Anonymous access types in Ada 2005 can point to different - members of a tagged type hierarchy. */ - gcc_assert (TYPE_MAIN_VARIANT (TREE_TYPE (left_base_type)) - == TYPE_MAIN_VARIANT (TREE_TYPE (right_base_type)) - || (TYPE_ALIGN_OK (TREE_TYPE (left_base_type)) - && TYPE_ALIGN_OK (TREE_TYPE (right_base_type)))); + members of a tagged hierarchy or different function types. */ + gcc_assert (TYPE_MAIN_VARIANT (left_ref_type) + == TYPE_MAIN_VARIANT (right_ref_type) + || (TYPE_ALIGN_OK (left_ref_type) + && TYPE_ALIGN_OK (right_ref_type)) + || (TREE_CODE (left_ref_type) == FUNCTION_TYPE + && TREE_CODE (right_ref_type) == FUNCTION_TYPE)); best_type = left_base_type; }