From patchwork Mon Sep 12 08:19:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Marc_Poulhi=C3=A8s?= X-Patchwork-Id: 1155 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:5044:0:0:0:0:0 with SMTP id h4csp1782362wrt; Mon, 12 Sep 2022 01:34:39 -0700 (PDT) X-Google-Smtp-Source: AA6agR6hXcnaPJhDCEy8ru2zbs6KfccKtkPZITp0CSkmqY6c238zXV9Z7LAX3CTD88vW2co7OwKX X-Received: by 2002:a17:907:3f26:b0:77c:2508:3c08 with SMTP id hq38-20020a1709073f2600b0077c25083c08mr4962787ejc.532.1662971679246; Mon, 12 Sep 2022 01:34:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1662971679; cv=none; d=google.com; s=arc-20160816; b=ZfCy9dbwHH6ulqmtZ1FM1jdb+uLddF/5VfT3balsIpmvega1vUFuTPefdmA4rHwuNW BAYicXf4lwZ4Lxpn0NFQg6ZNx86dxiTGX7ERKVm3ZNkCYX4/YqhP1VuimH2FP5D+4ubD sq7auBlwmWFtMWiOPDC8m5LlaLozTV7rPB+qtDomB5xANrIjrNd/6zIR/SAq2vYka5Jw cFrJblPV7PwosJDkrFovd1XXiYm9j4YRN7VS1qhgkcxGdFGv3RzFmo6ibYRBxN9HLXlA FyhuBoytPWoSCvXf3ImbQ/dxyayJJSTzLSKSUhNWG6WYjgdGhQHyBiEAKQZ87mlSc416 1aAg== 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=Mhh6MfwVrnwEUCkbM8neUFKMIXsrYxQXwDQo0ETm+DU=; b=crKQEZBVmjbkgpnSovbUBNvNqCfYs0yK38XB8ZMrYPM1UOUgOsIjTxaglnLnU6cNhH zNYwj7priWCOHitWw9QlhSMRY5ccrY2oQ3M21dE1jyiyZhwuGGSltPZ4FpBbBOY/Wu1B VnsFo/M4Ry7mm5pZt+O6/30BewaaLSEPefNq7F6g4vFSScpiX3qX81zYXMl2U0eJE+mg nqVHAzeG9GOC7Yr9fBATjBO5eHOp6cgVG4ub8Q5cBNG5uSrLyz7QpIDzvdY20sn3ZN9a 4hRUaL9YeeyaHAVOh2zv79lgLL0ohl/x0EEbS022Y93qdrgyLKeRe/iqkBNT0jp5l4ed XeUA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=IZ56+FhJ; 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 qf10-20020a1709077f0a00b0077bbac643c7si4824117ejc.879.2022.09.12.01.34.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Sep 2022 01:34:39 -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=IZ56+FhJ; 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 C4A6E394D830 for ; Mon, 12 Sep 2022 08:26:13 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C4A6E394D830 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1662971173; bh=Mhh6MfwVrnwEUCkbM8neUFKMIXsrYxQXwDQo0ETm+DU=; h=Date:To:Subject:List-Id:List-Unsubscribe:List-Archive:List-Post: List-Help:List-Subscribe:From:Reply-To:Cc:From; b=IZ56+FhJQ2TDYs7izZL5sCwUEo05XzcvxptnC3hqaJ/nrF3cks1zM+OuK3PnyqYav GDE5tcki8WeyWwvBVDldLUvkHcxzROxbYyXuE8YyCaUyb4V83jUfjgMOwIDmQK7tNW lcy6baN4W1vgvMw8NVL2CmVj5BUL55Bfh19fP2Ow= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x433.google.com (mail-wr1-x433.google.com [IPv6:2a00:1450:4864:20::433]) by sourceware.org (Postfix) with ESMTPS id C7FF0385AE6C for ; Mon, 12 Sep 2022 08:19:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org C7FF0385AE6C Received: by mail-wr1-x433.google.com with SMTP id k9so14124004wri.0 for ; Mon, 12 Sep 2022 01:19:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-disposition:mime-version:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date; bh=Mhh6MfwVrnwEUCkbM8neUFKMIXsrYxQXwDQo0ETm+DU=; b=GZKEZ4wviJFf01BTCHtMmMBD1paABG04oLk3sYWFdH1g1etCeKqYYGqNKs0ysTKZ5n Fd5Kc3cVGHM9h/1NYAQbJYp7CtRUa9OAjGvQlKc4WEZCORjiYH8pL5QabWwlUywrcodO 7jacOE+wFx2KYC1MZLIiEIO94maQFLh7Zrcc+rvr3GMPomywSSybPqQvJ7zdvSJT7F8f qd5hJkAt/M+BkuFxHk61/8EkGlDZ2aQM29F0FcGpvJWr4e7K4wyIKr6P+97lMdRgdBfc hfrefTTfIitiQi4lk/9dQPSjqWHS9J6iaaHhW0XK0A6yViOra3qzlRG3LkWTk+Ccr5ji 5EKw== X-Gm-Message-State: ACgBeo2mWHHdUcJfaCtRIb1f3zhabuqlg6uaasxVXYyQELxbjKkUOoDX xl6F0rJlI710Zsb3rjD8PgKms0bvxpIllw== X-Received: by 2002:adf:db44:0:b0:22a:56eb:927f with SMTP id f4-20020adfdb44000000b0022a56eb927fmr4715027wrj.627.1662970787446; Mon, 12 Sep 2022 01:19:47 -0700 (PDT) Received: from poulhies-Precision-5550 (lmontsouris-659-1-24-67.w81-250.abo.wanadoo.fr. [81.250.175.67]) by smtp.gmail.com with ESMTPSA id b5-20020a5d4b85000000b00223b8168b15sm6602563wrt.66.2022.09.12.01.19.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 12 Sep 2022 01:19:46 -0700 (PDT) Date: Mon, 12 Sep 2022 10:19:46 +0200 To: gcc-patches@gcc.gnu.org Subject: [Ada] Fix immediate assertion failure with -gnatd.1 Message-ID: <20220912081946.GA1513177@poulhies-Precision-5550> MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-12.7 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.29 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: =?utf-8?q?Marc_Poulhi=C3=A8s_via_Gcc-patches?= From: =?utf-8?q?Marc_Poulhi=C3=A8s?= Reply-To: Marc =?iso-8859-1?q?Poulhi=E8s?= 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?1743752191541882995?= X-GMAIL-MSGID: =?utf-8?q?1743752191541882995?= The switch enables the front-end unnesting pass. Tested on x86_64-pc-linux-gnu, committed on trunk gcc/ada/ * gcc-interface/decl.cc (gnat_to_gnu_entity): Relax assertion when front-end unnesting is enabled. diff --git a/gcc/ada/gcc-interface/decl.cc b/gcc/ada/gcc-interface/decl.cc --- a/gcc/ada/gcc-interface/decl.cc +++ b/gcc/ada/gcc-interface/decl.cc @@ -436,7 +436,8 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition) /* If this is a numeric or enumeral type, or an access type, a nonzero Esize must be specified unless it was specified by the programmer. Exceptions are for access-to-protected-subprogram types and all access subtypes, as - another GNAT type is used to lay out the GCC type for them. */ + another GNAT type is used to lay out the GCC type for them, as well as + access-to-subprogram types if front-end unnesting is enabled. */ gcc_assert (!is_type || Known_Esize (gnat_entity) || Has_Size_Clause (gnat_entity) @@ -445,6 +446,9 @@ gnat_to_gnu_entity (Entity_Id gnat_entity, tree gnu_expr, bool definition) && (!IN (kind, Access_Kind) || kind == E_Access_Protected_Subprogram_Type || kind == E_Anonymous_Access_Protected_Subprogram_Type + || ((kind == E_Access_Subprogram_Type + || kind == E_Anonymous_Access_Subprogram_Type) + && Unnest_Subprogram_Mode) || kind == E_Access_Subtype || type_annotate_only)));