From patchwork Tue Nov 22 12:36:20 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: 24338 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp2174338wrr; Tue, 22 Nov 2022 04:37:39 -0800 (PST) X-Google-Smtp-Source: AA0mqf4w5vzvIz9BMY2ntKJZoRrZycj75Vh7aa7poDxMxU9MqFgaMXp4x/qARRPwGozdf0iE/24D X-Received: by 2002:a50:ff08:0:b0:461:dbcc:5176 with SMTP id a8-20020a50ff08000000b00461dbcc5176mr8681456edu.53.1669120659454; Tue, 22 Nov 2022 04:37:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669120659; cv=none; d=google.com; s=arc-20160816; b=yh3RovMW/Da25GJsMj+ehmT1XiRVq2XKum7Enl8eyVsOwzdJHelvVC/PxuyE7gpbCw sDVaSrGlZMtk95LUe99HoJ1tAG0nRZ653iwR8Q4fhw1PKc5JUqs7x6tQLmLtVszuCWkv vV+5/gExMBf/NMijLnPbMFvKgIWwhPucb18tKDlguEfLRrtMqgkIGamA7tyyJxviPojx nC83a35PwDRvjUFKP5S/oBTGAG8NCTOc/Ri7etAquXjzMVkocH/pFcLw/RhysISayA5M RHSXGSanIkEnWdtDmaDX9eoidv4lJKHuNYTiaDXcboSsp522/8N2GjCMUh467IuSMHCy dTJw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:reply-to:from:list-subscribe:list-help:list-post :list-archive:list-unsubscribe:list-id:precedence :content-transfer-encoding:mime-version:message-id:date:subject:cc :to:dmarc-filter:delivered-to:dkim-signature:dkim-filter; bh=QMzj6Jcy9Wqv1fhQJMbvLo4YnvAeR+Rkne2NsfdSjlc=; b=tzUPg28M9GYrPMd0yQj9Uy1MWeC1hjNjKyTfvDQmwfKGjk3tgrxucC6doNVKx8qpp2 FxBT1ErAsybeBrc0T6Poddq/Py9A08y8LYvpeTztAmSZR0/EuGx2i76cp+p8auTxJR0W WWeXG0awbHzypupl7Y/sYzsK2IeXeg3pJgk58C4SIEC6zow2s1tQmyvXfmZIp3VFkg2o 5C95kWdMqBSN+wHXB6aXmS6OmehC/mJYtWHa9bs/K80r33GNNfTqbStyaQ6NHcgWjJoH WXCUKC+gd9YBuk8igLcgCc2aj6GF42mMG4dzNc86TJIJkoBt+MsvPAXDVkw5hfPQ6gJ5 5XWQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=Qi89Hwqg; 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=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from sourceware.org (ip-8-43-85-97.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id i6-20020a1709063c4600b007123952b00dsi8560511ejg.100.2022.11.22.04.37.39 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Nov 2022 04:37:39 -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=@gcc.gnu.org header.s=default header.b=Qi89Hwqg; 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=NONE sp=NONE dis=NONE) header.from=gnu.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 19B4B3852C7B for ; Tue, 22 Nov 2022 12:37:19 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 19B4B3852C7B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1669120639; bh=QMzj6Jcy9Wqv1fhQJMbvLo4YnvAeR+Rkne2NsfdSjlc=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=Qi89HwqgRazwwPJ9dN/M3+/IWSrT4kgJy2+v1/xloZT3HPUGjB9qmvD15TUeAqBor 6LD5fPKzAtlqqdMv6iDHesuinLDM0fTDMQFUqnDBW2Gm06uqSRMvlTjpI6Cz1qez0g yGzGalcb7GJrzlrGP7VVMh7VJkayNIqElWwRb96s= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) by sourceware.org (Postfix) with ESMTPS id C50543858C54 for ; Tue, 22 Nov 2022 12:36:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org C50543858C54 Received: by mail-wr1-x42f.google.com with SMTP id bs21so24516802wrb.4 for ; Tue, 22 Nov 2022 04:36:33 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=QMzj6Jcy9Wqv1fhQJMbvLo4YnvAeR+Rkne2NsfdSjlc=; b=NYX4/kekEDFLbpjLKFf02i5ka8FV9KY80s14o2vkXFvk67dfdNjwmvzu5vc4/8OSGO J0yGvob+oDE4cGBMRSoo97AANydle988tybrsR5N38cgfgrd08r/eqFmmVOQ2GAZYof3 a3GX+PDCUbqVpevjuBB5PGQ86zKesqDLVRHYn1eh7tx1oWxr9e7X98wtOVElvAN5X36Y H2mCn7OLu2iMnJC7C+rqLwk8CyI9JgayBPl+aaQfhBz8lP89oySjQRhUK2CRNtAAcdi9 BDSJC1uHO1VMCNaseucWSwb+WdZIgm29cS2alfI4VyoZ1xODFHf/EBjIZyd6fFf00/LJ cG6A== X-Gm-Message-State: ANoB5pnudrCMa4wqeM4frehnxLg5behke5sgMDr5+VlOcVJX9GM9V2rb SV4sz5+vXc+TB1ALcE6GS7gZYD1oWKlvZw== X-Received: by 2002:adf:de08:0:b0:236:e271:ead4 with SMTP id b8-20020adfde08000000b00236e271ead4mr5645634wrm.426.1669120592461; Tue, 22 Nov 2022 04:36:32 -0800 (PST) Received: from poulhies-Precision-5550.telnowedge.local (lmontsouris-659-1-24-67.w81-250.abo.wanadoo.fr. [81.250.175.67]) by smtp.gmail.com with ESMTPSA id h14-20020adffa8e000000b0022e653f5abbsm3629525wrr.69.2022.11.22.04.36.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Nov 2022 04:36:31 -0800 (PST) To: gcc-patches@gcc.gnu.org Cc: Eric Botcazou Subject: [COMMITTED] ada: Fix recent assertion failure on GPR2 Date: Tue, 22 Nov 2022 13:36:20 +0100 Message-Id: <20221122123620.336156-1-poulhies@adacore.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 X-Spam-Status: No, score=-13.1 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 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: =?utf-8?q?Marc_Poulhi=C3=A8s?= 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?1750199864383550072?= X-GMAIL-MSGID: =?utf-8?q?1750199864383550072?= From: Eric Botcazou It's the compiler trying to load the nonexistent body of a generic package when trying to inline a call to an expression function of this package that has a pre or post-condition (hence the need for -gnata to trigger the ICE). gcc/ada/ * contracts.adb (Build_Subprogram_Contract_Wrapper): Do not fiddle with the Was_Expression_Function flag. Move a few lines around. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/contracts.adb | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/gcc/ada/contracts.adb b/gcc/ada/contracts.adb index fef3d24870f..6f474eb2944 100644 --- a/gcc/ada/contracts.adb +++ b/gcc/ada/contracts.adb @@ -1691,6 +1691,10 @@ package body Contracts is Set_Debug_Info_Needed (Wrapper_Id); Set_Wrapped_Statements (Subp_Id, Wrapper_Id); + Set_Has_Pragma_Inline (Wrapper_Id, Has_Pragma_Inline (Subp_Id)); + Set_Has_Pragma_Inline_Always + (Wrapper_Id, Has_Pragma_Inline_Always (Subp_Id)); + -- Create specification and declaration for the wrapper if No (Ret_Type) or else Ret_Type = Standard_Void_Type then @@ -1719,20 +1723,6 @@ package body Contracts is Make_Handled_Sequence_Of_Statements (Loc, End_Label => Make_Identifier (Loc, Chars (Wrapper_Id)))); - -- Move certain flags which are relevant to the body - - -- Wouldn't a better way be to perform some sort of copy of Body_Decl - -- for Wrapper_Body be less error-prone ??? - - if Was_Expression_Function (Body_Decl) then - Set_Was_Expression_Function (Body_Decl, False); - Set_Was_Expression_Function (Wrapper_Body); - end if; - - Set_Has_Pragma_Inline (Wrapper_Id, Has_Pragma_Inline (Subp_Id)); - Set_Has_Pragma_Inline_Always - (Wrapper_Id, Has_Pragma_Inline_Always (Subp_Id)); - -- Prepend a call to the wrapper when the subprogram is a procedure if No (Ret_Type) or else Ret_Type = Standard_Void_Type then