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: 60972 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 5893E3858022 for ; Tue, 22 Nov 2022 12:37:04 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 5893E3858022 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1669120624; 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=E1VVuo9Xoku0K/txzONde1kb5CUT7nYP2KvOi9eOHsXruu+iY5O2Dohs1SIuSloLl KBep7TWdt/JEUB8x1NjDDultnaablcDN1S2ZulKBE2cy/ehAByr6JGkz0yf+7NbP97 mX7OlEjxDGhVRF9wLP6BoblDC6ZkKUKhgplRFv/U= 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-Google-Smtp-Source: AA0mqf5dgbdCP7wA7WL1n6807lFXDFA6zlDPi3/kYWl1kLJAKO1AY0SZDirAgVZxHJl4ETpBRBzYWA== 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+patchwork=sourceware.org@gcc.gnu.org Sender: "Gcc-patches" 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