From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com Received: by mail-wm1-x332.google.com with SMTP id 5b1f17b1804b1-3f423ac6e2dso69025065e9.2 for ; Tue, 16 May 2023 01:41:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1684226465; x=1686818465; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=JTjo0/xoRhCd6v3P6OpLKdaWFGZxVI3eup7zmebzAFM=; b=AtcxrG/Zmg1DvR4BK0UTzmxxueZCeUOdruR+Z14XRoJc5scxv+TQhoDyYT1Ap1DcKm dqD8yrB9ZwAFBGjM6nwBDXRdjtpyXebWkfZLheGVQTtWSlY/fkNvEuBFG5xXlaoijM5T nKJO2MKJzM4+laCV9Re7NZG5EaidxgVSuXrlbuq3Suyy6k+Z6IoAONnbj5QzqVJH+jA8 D9zUFaO2JJFy5F4TSY278Qyy0WCg3KooWgPq3DiIgBvr9qiziGex7gcH4R0Od5+faLiK OytZCjyFMbl+KTECYO2x9uuSBDfMhsO9a3nc97DK7cjzZWhmoPmqsh3150u1Phe/EuFE lKKw== 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-Google-Smtp-Source: ACHHUZ5XINAURhrMjMVycX6WyQ+/22Qc6RU2SnDxNQimGGoHtAMaj6z04m4MpMuVUfdCuY02KU8ftQ== 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) From: =?UTF-8?q?Marc=20Poulhi=C3=A8s?= 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 Content-Transfer-Encoding: 8bit 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 List-Id: 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; ------------------------------------- -- 2.40.0