From patchwork Tue May 16 08:41:03 2023 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: 94536 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp274695vqo; Tue, 16 May 2023 01:53:28 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7h/toJLteEPwmffvIYC1cjiNRwouetSulhTDcTqbu1WZz4GCoZ+GiMHQes95EA+twq8NGK X-Received: by 2002:a17:907:3e99:b0:969:93f2:259a with SMTP id hs25-20020a1709073e9900b0096993f2259amr26216032ejc.73.1684227208178; Tue, 16 May 2023 01:53:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1684227208; cv=none; d=google.com; s=arc-20160816; b=inlQeVBYj7l7/wnl6FbaUfIcLnEZBR/rhnztdjF3Sgv88p8YP5Mz4VJGRxmaSNGDqa +xcS9C3zAVn2cf0rBbjQAmtbpSFvenlumDN5M3YJARuhMnYO4vNVHdipxICFWwbdafJF pWVm9mlVrA1U5PjODSCsfRrsXqPuJWdXCPbcDBwdCEY/OevGLx54Wb3aDXxze3pf9Vsx vU4pLZRC5cpMWoSxWKATvqxxnKr3VyihLYxaQkj0tfffkK+G4sSiNvrp2esiNrQ17yrj kYb34l8VWJJX2h3ZyyhpihXZV78wu2b6fD/Rcgnls6Lvw/R+7GsHmdI152bZ8ymkd/fW 3W/g== 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=JTjo0/xoRhCd6v3P6OpLKdaWFGZxVI3eup7zmebzAFM=; b=lC5bKaGGM/2YDexQlnEYSDIPMrIGX2HVygUG7DxLOhhcxSEklRHv8ncjOXHXLsw7VJ 8327bd5IZVyjHgxeBgaeysOSZOx4qlx1rDy9aPDFVzwDl6AcMJ6j9bFEy8d0b9hTMNjD BXXCk8so5WH4j4y92v6lwtlOILSkuwU/Sc7rZyGvvJzoDHgxZshZnttXlTLWuOPNqjij z0FggUeOYM5SkqMFH1i/xb5PrzgfdoXIuSJgIxRHUuup4Dnbmmo1v+UD9fEJUNWNGGRz t2duCnnUa4Z619FlHAXh9F11SIiv+zyEQGNVd1OgMfoQNMTsP09IIVJv0N6luxKI51Ld qoBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=IVCNqodo; 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 (server2.sourceware.org. [8.43.85.97]) by mx.google.com with ESMTPS id sb31-20020a1709076d9f00b0096b1c28511fsi4577680ejc.745.2023.05.16.01.53.27 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 May 2023 01:53:28 -0700 (PDT) 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=IVCNqodo; 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 CE4753855588 for ; Tue, 16 May 2023 08:46:49 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CE4753855588 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1684226809; bh=JTjo0/xoRhCd6v3P6OpLKdaWFGZxVI3eup7zmebzAFM=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=IVCNqodo/GMIfLDIIQgjsJlZOKyIy4slGkomTrgR0YbNr6ZC6Y8yqGUHOytgzk3Ge yfpGH61C6DAK88gkQ/M84Fl7Cou0Bcxcy+X2dDfUTQ6dIhnr1/PWABaIhQU08TpzoB mbFAo4XBLZYlzAJ9L21kivDEMgO4LLE4j8E08mt8= X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x332.google.com (mail-wm1-x332.google.com [IPv6:2a00:1450:4864:20::332]) by sourceware.org (Postfix) with ESMTPS id CF2A13850855 for ; Tue, 16 May 2023 08:41:06 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org CF2A13850855 Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-3f423ac6e2dso69025065e9.2 for ; Tue, 16 May 2023 01:41:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1684226465; x=1686818465; 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=JTjo0/xoRhCd6v3P6OpLKdaWFGZxVI3eup7zmebzAFM=; b=BasQMPcvhgFkt1FHbDA30Unp03K7ZD6vZ1QkJYyey6I91jzpLqFiKVweutcItZV6IA MPOzEkOZVgsPFO0OqZqMp7SoM1HfURpbmREAJX8yqinwXQEXGRNF9MabvMSA+KyQV9dG jvC6Fp3sufq5fW9u3UFmnEx/ipdIxEhlBtQmK2d41CjwzRg59uYO2aFgbOoVJXRY69R2 xos5n8ZDxLBLbVvRzOPhhalqo0e1zvRlSWSKcGwQxhYHVG/AEU6vf3NtDxDEEmdAtb2d PkmxFtCrvBLfNmlWgbGYU8FK/UMJv5xp2gBVlr4VTPt0ci436julLjt1VT/BWEbxiFkR jBcQ== X-Gm-Message-State: AC+VfDxLSsVtsa99fr5L1hAN46i8mUgM6uUvuSEOJ65jOeWKokKQkzz/ Uze7d+voycktbudL07nsFFMDJOhHR/xtorK7P+b4Zg== X-Received: by 2002:a1c:f007:0:b0:3f3:2b37:dd30 with SMTP id a7-20020a1cf007000000b003f32b37dd30mr25225347wmb.22.1684226465662; Tue, 16 May 2023 01:41:05 -0700 (PDT) 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 p22-20020a7bcc96000000b003f1958eeadcsm1536145wma.17.2023.05.16.01.41.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 May 2023 01:41:05 -0700 (PDT) To: gcc-patches@gcc.gnu.org Cc: Javier Miranda Subject: [COMMITTED] ada: Spurious error on function returning CPP type Date: Tue, 16 May 2023 10:41:03 +0200 Message-Id: <20230516084103.1502006-1-poulhies@adacore.com> X-Mailer: git-send-email 2.40.0 MIME-Version: 1.0 X-Spam-Status: No, score=-13.5 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: =?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?1766040228632782431?= X-GMAIL-MSGID: =?utf-8?q?1766040228632782431?= From: Javier Miranda gcc/ada/ * exp_ch6.adb (Needs_BIP_Alloc_Form): Return False for functions with foreign convention since we never use build-in-place for such functions. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/exp_ch6.adb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/gcc/ada/exp_ch6.adb b/gcc/ada/exp_ch6.adb index af7f75342fa..b8e5a720a7c 100644 --- a/gcc/ada/exp_ch6.adb +++ b/gcc/ada/exp_ch6.adb @@ -9435,9 +9435,14 @@ package body Exp_Ch6 is -- types, and those can be used to call primitives, so the formal needs -- to be passed to all such build-in-place functions, primitive or not. + -- We never use build-in-place if the function has foreign convention, + -- but note that it is OK for a build-in-place function to return a + -- type with a foreign convention because the machinery ensures there + -- is no copying. + return not Restriction_Active (No_Secondary_Stack) and then (Needs_Secondary_Stack (Typ) or else Is_Tagged_Type (Typ)) - and then not Has_Foreign_Convention (Typ); + and then not Has_Foreign_Convention (Func_Id); end Needs_BIP_Alloc_Form; -------------------------------------