From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx07-00178001.pphosted.com (mx08-00178001.pphosted.com [91.207.212.93]) by sourceware.org (Postfix) with ESMTPS id 37C8D3858408 for ; Wed, 7 Feb 2024 16:22:40 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 37C8D3858408 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=foss.st.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=foss.st.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 37C8D3858408 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=91.207.212.93 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707322962; cv=none; b=uY3Nl7RLw3QkzlnacJ3U0R2CTrKyE9WL7a7XP9tPWKO/yLaVSHxAENTt3Eq4RNaV7jHlK2OIQhtUltvtIr1gt5ffvT9dR6jkTlvynwkzgDcfbvDbxJw/tuzaspf0t0zvSYq7rOusuQO6nf/1pmCMqLKmzNc5n3ucuohC2qcmgBI= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1707322962; c=relaxed/simple; bh=Aw7v51mZMWZza8FVqGfsG9mHfT+gKibyj7mYmveZgNw=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=OMG/LAtyjzj2fJvzFP9Xl+hkJwQXJkhVJZJKigswkoRqRpVl/XkSRBZO8O7w0H7l7mKuGl/Ag2y0voRceSeiFace6Y82K992bwudaXwJ3LBhatBQ2IRkk1CCy+Vi3igcq6GUvVFHvsNackK2y2V1z+0jfiXWVJ3DOieBFhetVvY= ARC-Authentication-Results: i=1; server2.sourceware.org Received: from pps.filterd (m0046661.ppops.net [127.0.0.1]) by mx07-00178001.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 417BNIan014846; Wed, 7 Feb 2024 17:22:22 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=foss.st.com; h= message-id:date:mime-version:subject:to:cc:references:from :in-reply-to:content-type:content-transfer-encoding; s= selector1; bh=a08DrFIqjPnAnYDJhuARL8PV0ydzbKRpan3oMiNpARc=; b=A9 nyVCaNtQMrcaQsoSgOK9qsbpCrG91S2OeVFyyeUFL9Cc37JCWRT2VolDrvBYmBte aoh7bdsc0Ju/YeGKnTa1MCABDOgdjEDL5T244kolXYRL7nMZLlXkGnNugTIHKTzm RpPcFTiXod+3NfgKzyTZ9efrGVm7hsBJRET+DQzLDdFCUGE8glp/7i7Tl8DWGIuZ pZDgjL+DCdnwixbxACqox/RSfW3lRw3Xhe3QwOYnTg8KyUho9cYa5aiBnRfjdQ9G SAS0okD8Tj1YtnWzXqk49dFYRxYp6h49SZRJTMJpT5Dpp7ctwuFAnByUV6CiWRF7 NOJDYYcsIACZitZwBxpg== Received: from beta.dmz-eu.st.com (beta.dmz-eu.st.com [164.129.1.35]) by mx07-00178001.pphosted.com (PPS) with ESMTPS id 3w1f63rpxv-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 07 Feb 2024 17:22:22 +0100 (CET) Received: from euls16034.sgp.st.com (euls16034.sgp.st.com [10.75.44.20]) by beta.dmz-eu.st.com (STMicroelectronics) with ESMTP id 395D2100056; Wed, 7 Feb 2024 17:22:22 +0100 (CET) Received: from Webmail-eu.st.com (shfdag1node3.st.com [10.75.129.71]) by euls16034.sgp.st.com (STMicroelectronics) with ESMTP id 1DAB52676AB; Wed, 7 Feb 2024 17:22:22 +0100 (CET) Received: from [10.74.18.1] (10.74.18.1) by SHFDAG1NODE3.st.com (10.75.129.71) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2507.27; Wed, 7 Feb 2024 17:22:21 +0100 Message-ID: Date: Wed, 7 Feb 2024 17:22:21 +0100 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] c++: for contracts, cdtors never return this Content-Language: en-US To: Jason Merrill , Alexandre Oliva , CC: Nathan Sidwell , Yvan Roux References: <1eb10cb5-964d-4476-be8d-c1aac29a71f0@redhat.com> From: Torbjorn SVENSSON In-Reply-To: <1eb10cb5-964d-4476-be8d-c1aac29a71f0@redhat.com> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.74.18.1] X-ClientProxiedBy: SHFCAS1NODE1.st.com (10.75.129.72) To SHFDAG1NODE3.st.com (10.75.129.71) X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-07_07,2024-02-07_01,2023-05-22_02 X-Spam-Status: No, score=-9.0 required=5.0 tests=BAYES_00,BODY_8BITS,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,GIT_PATCH_0,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_PASS,TXREP,T_SCC_BODY_TEXT_LINE,URIBL_BLACK 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: Hi, Is it okay to backport 71804526d3a71a8c0f189a89ce3aa615784bfd8b to releases/gcc-13? Without this backport, I see these failures on arm-none-eabi: FAIL: g++.dg/contracts/contracts-ctor-dtor2.C (test for errors, line 23) FAIL: g++.dg/contracts/contracts-ctor-dtor2.C (test for errors, line 27 Kind regards, Torbjörn On 2023-11-20 16:40, Jason Merrill wrote: > On 11/19/23 02:28, Alexandre Oliva wrote: >> >> When targetm.cxx.cdtor_return_this() holds, cdtors have a >> non-VOID_TYPE_P result, but IMHO this ABI implementation detail >> shouldn't leak to the abstract language conceptual framework, in which >> cdtors don't have return values.  For contracts, specifically those >> that establish postconditions on results, such a leakage is present, >> and the present patch puts an end to it: with it, cdtors get an error >> for result postconditions regardless of the ABI.  This fixes >> g++.dg/contracts/contracts-ctor-dtor2.C on arm-eabi. >> >> Regstrapped on x86_64-linux-gnu, also tested on arm-eabi with default >> cpu on trunk, and with tms570 on gcc-13.  Ok to install? > > OK. > >> >> for  gcc/cp/ChangeLog >> >>     * contracts.cc (check_postcondition_result): Cope with >>     cdtor_return_this. >> --- >>   gcc/cp/contracts.cc |    6 +++++- >>   1 file changed, 5 insertions(+), 1 deletion(-) >> >> diff --git a/gcc/cp/contracts.cc b/gcc/cp/contracts.cc >> index 66d2298a9bfac..035ca4827e758 100644 >> --- a/gcc/cp/contracts.cc >> +++ b/gcc/cp/contracts.cc >> @@ -636,7 +636,11 @@ make_postcondition_variable (cp_expr id) >>   bool >>   check_postcondition_result (tree decl, tree type, location_t loc) >>   { >> -  if (VOID_TYPE_P (type)) >> +  /* Do not be confused by targetm.cxx.cdtor_return_this (); >> +     conceptually, cdtors have no return value.  */ >> +  if (VOID_TYPE_P (type) >> +      || DECL_CONSTRUCTOR_P (decl) >> +      || DECL_DESTRUCTOR_P (decl)) >>       { >>         error_at (loc, >>           DECL_CONSTRUCTOR_P (decl) >> >> >