From patchwork Tue Jan 9 09:23:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Botcazou X-Patchwork-Id: 186298 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:37c1:b0:101:2151:f287 with SMTP id y1csp1535844dyq; Tue, 9 Jan 2024 01:28:19 -0800 (PST) X-Google-Smtp-Source: AGHT+IFZ6upPE/+qBiJfhCeLmBNJSvQAGRzlCROVfVKGtQUCXdP7AXaaYgvf9SydIzFcM8XqITs8 X-Received: by 2002:a05:620a:3636:b0:783:137d:7b4c with SMTP id da54-20020a05620a363600b00783137d7b4cmr5133151qkb.120.1704792498904; Tue, 09 Jan 2024 01:28:18 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1704792498; cv=pass; d=google.com; s=arc-20160816; b=Z727fPvtOFPdEYJFZQR0cF/9Z+VN/kQL/jIBxZDlPoZIxd+Hts7NXn8tXEUEXX0P+G TSpICjn+YtKVZgHYOSYo8VJntbPasyEj+sHPh9sIPPZf/bzIs6HvZBoahOMoLz1suvmX qU2pliYNESXq0ASWqRwCLg8zYq9VR5PdREH1qlW2WTXCF6ctERkyg0kKpVXUbXJglUms DMxSKsc3PSo01o4syMDEjAgEwK+ZBEt7far/n9x66aXqJb8DbtrwmXsUXhUp97Fv/axO 0ATNJj3TCPNM9t3VPpgMIdJWGDgicmwTMoU/10f/H7aTR5SG180+jUZ7I0ZOImLvGC2x qkhA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:to:from:dkim-signature :arc-filter:dmarc-filter:delivered-to; bh=vFtOSKDrI5HKfL4qlhFbChAg/KSfhDnKOGzOq+KvWXM=; fh=hPrbWPhweUx4V0GV9uXJqbyAzg2ABmTz7kczrAQqMmM=; b=0DjM4UdiG52y3kea31pXKTcO8lMuU1q10Cl1juo1D27etWqkhbvb6zoT/ZllfDdXJA u/SpNuO7xXT2d3djQj1qVBJuqX9fIwDrYkDmEHNxqPBnoZO4Y/+AEGWIyOBh/DG1xhAn AOWK+4UA0GUi3Ey74mpXo3vA6K68Rirb5WULvOOW9YKS7h0ET9UG4FokN1FHGOdog7Ca LBuTqsY8DzhrwNHmQ0xg26FkfbfaAxeIitLcLyFkKSg4pgIit8bpYldYVCHIGH/XXM+4 i545d6iO7dwpcRL87bgaB/kBZtJmysqj4BNtIyg+xxWOHyhDQiOjUSuhymkiIjHkZp4h fF4A== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@adacore.com header.s=google header.b=CcMRfuL1; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=adacore.com Received: from server2.sourceware.org (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id w13-20020a05620a094d00b00781ae73540csi1555099qkw.469.2024.01.09.01.28.18 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jan 2024 01:28:18 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) client-ip=8.43.85.97; Authentication-Results: mx.google.com; dkim=pass header.i=@adacore.com header.s=google header.b=CcMRfuL1; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 8.43.85.97 as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=adacore.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 38185385DC18 for ; Tue, 9 Jan 2024 09:28:18 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x334.google.com (mail-wm1-x334.google.com [IPv6:2a00:1450:4864:20::334]) by sourceware.org (Postfix) with ESMTPS id 91CE33858012 for ; Tue, 9 Jan 2024 09:26:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 91CE33858012 Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 91CE33858012 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::334 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704792405; cv=none; b=a7k3WVn3+RU3Y6GPop9KIU/FOSew4e/tyqcLKx7idXuq+oFUjh21ajnAm1o5JEmH1ibb4bynfEUljSjWCNTQrHEkZHkCuyZz7Yurq5n73VOiYGS1AyzK+n9LShdEvIZrvos+DxMxS14JGhYuQNa1k8ThXcYvtp1xO4hZcjC26CM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1704792405; c=relaxed/simple; bh=6cUyqZNfVMazvSiJOKeUjWXQNMFUU1D2u6CL2Abe6UU=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=PdGU8C3aryrCskz6r59kkTrzVPO9mBwfmGqEEV7A+GA94kHRGCm1suC8jl1F/66NDGg1UIBJaNmV64B0tVTgSsN6kiHLvpV3+K3PODq4aMSxNvObC98E7PrgTkHqwOOc67PJ06d9SA4tLoZ7zy2Ey0fZGYJNnkuOOKKl8LfOVYs= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wm1-x334.google.com with SMTP id 5b1f17b1804b1-40e43e489e4so27309375e9.1 for ; Tue, 09 Jan 2024 01:26:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1704792401; x=1705397201; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:from:to:cc:subject:date:message-id:reply-to; bh=vFtOSKDrI5HKfL4qlhFbChAg/KSfhDnKOGzOq+KvWXM=; b=CcMRfuL1isQnLMQGtyjpWYxoV4ex3siG4sD1t/FXYP0n5PEHFFjOiJdl0xu071wo2R 8NwgfIZ2gpIT9TLfqqZ68a06VvcvuF+apCgMY0kHkETfrXXbgSqSGGNQ4HtPLDGL7sT2 s22TYYZb1K05N0HdtxGurK38TuW7BpLPo5K66wSmP0uDTRG7jOfAamhba8UXCXns7Ytn sv+tuG8CNa3SIq8/Dk4ln49UE/5mY8rc9kggCwvGMamiL1qArtYi4n0a6gQIAD7MArC4 JE6g55/OaOIJ18PiY8oQTruJbIEugqM7SgRhDFxWsyoMk8PRyESm4LbA7mXgzDoDVnNx Z7EQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1704792401; x=1705397201; h=content-transfer-encoding:mime-version:message-id:date:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=vFtOSKDrI5HKfL4qlhFbChAg/KSfhDnKOGzOq+KvWXM=; b=cxDrotV8Mbbfd/AUO3zCP25aLtcO108omMDknPd0eQDJU4EzyhC5yH3s4mUi3OPclz SUNGRfWqCfejYaby3WxZ3L2d26ez5a0BQMuCRwdYqCLNZZ7UfR40Jofww0hu+p/+4y33 te55tkP6rI1jBoUf7R2ZOWe0CpoTw03VmmdYxc7rJ6eV+x5WFr0zoZSgADlVYVMbd/Q9 nhUDt5NhZRYnCsh2nFGf0W3B++gZqAXbdIU8w+mEbKQhh2enqeN/mubLuUs1/dPbDL6i GCtAHyoY8rh5eH+Jctvhp3d4z6r0BTIHRyluAC7000QxRnhSETLt8H2Np3n+aavivJAv 3IZw== X-Gm-Message-State: AOJu0YxLl/VgfZ4JBdMnE0Z9s7mCN+MghA6Ume8IezlDi8EnbogxU3K3 wejys1cxE9TPD9Ny8SYN0SZnwTH1PY9pUOrqb/iw/487bA== X-Received: by 2002:a05:600c:3b87:b0:40e:4861:2f8e with SMTP id n7-20020a05600c3b8700b0040e48612f8emr1352097wms.80.1704792401271; Tue, 09 Jan 2024 01:26:41 -0800 (PST) Received: from fomalhaut.localnet ([2a01:e0a:8d5:d990:e654:e8ff:fe8f:2ce6]) by smtp.gmail.com with ESMTPSA id u20-20020a05600c139400b0040d8d11bf63sm2771153wmf.41.2024.01.09.01.26.40 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jan 2024 01:26:40 -0800 (PST) From: Eric Botcazou X-Google-Original-From: Eric Botcazou To: gcc-patches@gcc.gnu.org Subject: [Ada] Fix PR ada/113195 Date: Tue, 09 Jan 2024 10:23:44 +0100 Message-ID: <3783379.kQq0lBPeGt@fomalhaut> MIME-Version: 1.0 X-Spam-Status: No, score=-10.4 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, KAM_NUMSUBJECT, 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.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787604499489667167 X-GMAIL-MSGID: 1787604499489667167 This is a small regression present on the mainline and 13 branch, in the form of an internal error in gigi on anonymous access type equality. We now need to also accept them too for anonymous access types that point to compatible object subtypes in the language sense. Tested on SPARC64/Linux, applied on the mainline and 13 branch. 2024-01-09 Eric Botcazou PR ada/113195 * gcc-interface/utils2.cc (build_binary_op) : Relax assertion for regular pointer types. 2024-01-09 Eric Botcazou * gnat.dg/specs/anon4.ads: New test. diff --git a/gcc/ada/gcc-interface/utils2.cc b/gcc/ada/gcc-interface/utils2.cc index 6a951093ff8..df11eef2101 100644 --- a/gcc/ada/gcc-interface/utils2.cc +++ b/gcc/ada/gcc-interface/utils2.cc @@ -1142,14 +1142,10 @@ build_binary_op (enum tree_code op_code, tree result_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 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)); + /* Anonymous access types in Ada 2005 may point to compatible + object subtypes or function types in the language sense. */ + gcc_assert (FUNCTION_POINTER_TYPE_P (left_ref_type) + == FUNCTION_POINTER_TYPE_P (right_ref_type)); best_type = left_base_type; }