From patchwork Wed Jul 13 10:03:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pierre-Marie de Rodat X-Patchwork-Id: 225 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a98:d5ce:0:b0:178:cc93:bf7d with SMTP id g14csp166491eik; Wed, 13 Jul 2022 03:11:47 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vOqTWUNv903aV1+yvF8GVaQVgn2ZknnnUjSV2R5FUAE6CzCnbOHsKBtlRv1x62YuwZHST1 X-Received: by 2002:a17:907:6d8b:b0:72b:5f51:a9e7 with SMTP id sb11-20020a1709076d8b00b0072b5f51a9e7mr2718876ejc.628.1657707106943; Wed, 13 Jul 2022 03:11:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657707106; cv=none; d=google.com; s=arc-20160816; b=NFhlFeL6vjI+Hr26t7v7JdFFYm9FsufunsAc5Il+/hfGxOVT4s9gn2iVLpSGtbwrVF 11LENs6b6kHAWghYFxTFuBxvoqDZjmzhmUuqnl+mnzoZ8cVJUYoNwj9HPiigZhKKkrfM hDPqH8vPeOVq2LjpNR7IMihjbTUg/3J6I77IcafL/OjzcG241BZjkB6ci+zQmSnr8XkW FtJp0nN0tKJoYcDxKDizYU325VIgye1HF+goOb5f+ezeqWlqEw3pcAqcF31/ZQrjx4y8 BpMbq9/DPJNtIPy5eWTo6qWj+UdiiNwpJS5e/Ml1ObaP87fz0HLz1xDqtG3dlW9XUtSA 7FNQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:reply-to:from:list-subscribe:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence :content-disposition:mime-version:message-id:subject:to:date :dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=ZZBGfnjEgjoqbU8vhCF+xtNaibTQ1QYdMi2VVM4us9g=; b=mHi6CcvsaVEJHitfIFIBLQcFCRlU/3DNcgujvKEosyt+vL61cB+GNAsQa9djnsH3DU 2/7VCmPwobl0oDgt4l4T1T2B8Kcvjnu/KxkiZVIqvcC8ohvBKSHbQd1Qcwm7jJSw3gbp Q3Xs0j/osIP/ZRlW0w0DqJbmSSbKQX5AOhp00jTroU5J3Est8AMND7XO7VESSjwKtj4K COTdSVyqFPWcQC/duOwMHIIixNzsMNKtOaWtAqkqDYNQX+S7oBKIwQH2TIULFgO6yv1V U2DXF5pRb8Usrx5HWA8AHcsY/0F03joow2I0NAoMvuw8y5HnVMt+VzUVbljXn8qTfSFY RSrg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=lQoUr9iw; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id fb17-20020a1709073a1100b00718bdf7794esi10450763ejc.487.2022.07.13.03.11.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Jul 2022 03:11:46 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=lQoUr9iw; spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 2B806388CEA3 for ; Wed, 13 Jul 2022 10:06:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2B806388CEA3 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1657706806; bh=ZZBGfnjEgjoqbU8vhCF+xtNaibTQ1QYdMi2VVM4us9g=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=lQoUr9iwVfJ3uRaNuZAgri7yk1IySt9UceHEj6iH5cCdUhZzw9/8h6Ph8VErvjAMv CC6lZYBlYJhIkGwULrAx8if7pYKQtezrA9u6ZdC3F/Z5JaC4jlkaVTxccNiQBkc8Mj kaYxjasOnrt8+nCy8peZpvu+LKClSqppQBw3THoQ= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-ed1-x52d.google.com (mail-ed1-x52d.google.com [IPv6:2a00:1450:4864:20::52d]) by sourceware.org (Postfix) with ESMTPS id 6283B3850874 for ; Wed, 13 Jul 2022 10:03:04 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 6283B3850874 Received: by mail-ed1-x52d.google.com with SMTP id eq6so13426288edb.6 for ; Wed, 13 Jul 2022 03:03:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:mime-version :content-disposition; bh=ZZBGfnjEgjoqbU8vhCF+xtNaibTQ1QYdMi2VVM4us9g=; b=77jv3zr9nBWv5EaDmflQMsASekSFkfss4HCBCAmkRxqeZZuXdgSycBshMpZ9EDdoGt PLofDNVvqBRmGTO/3imzcEzbbO5xAmOQPMx12inkAlZ14Uv1p9W8SchZzT20eOYS7apY c96/va6viv8Cn/1cHZDWCZyokLdvGN8LXR4eAuy+P1vjH4mfeMMtEMEZKsW9RYGszYR8 wLeA52GIPeBDEolrgPUnsNks/kVCLc7btRpeqIxjiEybMap0P+OIuMO/8D0q2E4tyiRi 8U5nGSbNIs76WqWVSggticWYnPtRHnGXLgIKbFYlONrPeLToyPcKOGqc/Rcj6o4b54Xx xJuQ== X-Gm-Message-State: AJIora/AC/gykbjXLegM2qyRpybV0Ljt+AdQvPpQTZLN4Xu+zIWEmJE7 3TClPvAFdmPj1fKatAeZ0D8lZUTb3Ht1jg== X-Received: by 2002:aa7:c2d1:0:b0:43a:997:c6d8 with SMTP id m17-20020aa7c2d1000000b0043a0997c6d8mr3589972edp.161.1657706583194; Wed, 13 Jul 2022 03:03:03 -0700 (PDT) Received: from adacore.com ([45.147.211.82]) by smtp.gmail.com with ESMTPSA id r24-20020a1709067fd800b006fe8b456672sm4809112ejs.3.2022.07.13.03.03.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Jul 2022 03:03:02 -0700 (PDT) Date: Wed, 13 Jul 2022 10:03:02 +0000 To: gcc-patches@gcc.gnu.org Subject: [Ada] Fix internal error on comparison with access function parameter Message-ID: <20220713100302.GA994761@adacore.com> MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-13.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Pierre-Marie de Rodat via Gcc-patches From: Pierre-Marie de Rodat Reply-To: Pierre-Marie de Rodat Cc: Eric Botcazou Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org Sender: "Gcc-patches" X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1738231887426497124?= X-GMAIL-MSGID: =?utf-8?q?1738231887426497124?= It comes from an overzealous assertion. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * gcc-interface/utils2.cc (build_binary_op) : Also accept pointer-to-function types that are not variant of each other. diff --git a/gcc/ada/gcc-interface/utils2.cc b/gcc/ada/gcc-interface/utils2.cc --- 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; }