From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) by sourceware.org (Postfix) with ESMTP id 4F170385B835 for ; Thu, 9 Apr 2020 16:55:30 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 4F170385B835 Received: from mail-qk1-f199.google.com (mail-qk1-f199.google.com [209.85.222.199]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-314-bzjinq8yMlqnnBIbcwbi1A-1; Thu, 09 Apr 2020 12:55:28 -0400 X-MC-Unique: bzjinq8yMlqnnBIbcwbi1A-1 Received: by mail-qk1-f199.google.com with SMTP id p8so4055076qkp.4 for ; Thu, 09 Apr 2020 09:55:28 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=RpIR/790ZTnGMypiwmseCuJ38SXA+rijkCI9eRIdKQo=; b=ZYQ+OA5Fah5eLP5FYyIKRW/MjmtGwHtJf2Moj3cQv0glD/Ral4asKiiLp005xsuHU0 J335ZriZ7Renx3uJ9XLG+tFhovS8NWyhVF1+SjX7kjHhSBpXPn6704yfJ/rpts+olEuQ 1jxGMLIkEuWpCnX1RYLV6/10VOjG8Vpequ75Gd/P6zEDAd8Mt6SJGzuyQV2LLS7avcoz Acf7eBlUW/8MMR2CAXzs7gRzfLdeFvJeuVjwaUnIOiaFAEyCN5uHBYLWKvwFdHKw1ftL 6DoORpjRlnAdb73kCI3YnOH5Ry+9edVbv3+4AR/n3vriDy4lEeBBG8dMa9g3N/8Ibj5V YfPw== X-Gm-Message-State: AGi0PuYHRz+u2SP2wRmdLzlgW1adTEvZds62j4D/ydIixU3QQ3T04MCQ CxYfZ0+FIKZnL8CEujWMooG2cW57gf+ScnU0H3+KE28q1Pj72sp0BCmcR6bstDFS+KnxDxaFGes bbrFD/ODJhzMCWTqiZA== X-Received: by 2002:ac8:2c0c:: with SMTP id d12mr293320qta.284.1586451327724; Thu, 09 Apr 2020 09:55:27 -0700 (PDT) X-Google-Smtp-Source: APiQypJ4ZtlZaTY68HIqNZ9FSPqnZS+6+4PR9gUyBnWmBSpdHxjtx9yY0uBu8TvXEzbs/OVYNY/tYQ== X-Received: by 2002:ac8:2c0c:: with SMTP id d12mr293284qta.284.1586451327325; Thu, 09 Apr 2020 09:55:27 -0700 (PDT) Received: from [192.168.2.148] (209-6-216-142.s141.c3-0.smr-cbr1.sbo-smr.ma.cable.rcncustomer.com. [209.6.216.142]) by smtp.gmail.com with ESMTPSA id o94sm11629776qtd.34.2020.04.09.09.55.26 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 09 Apr 2020 09:55:26 -0700 (PDT) Subject: Re: [PATCH] Allow new/delete operator deletion only for replaceable. To: =?UTF-8?Q?Martin_Li=c5=a1ka?= , Jakub Jelinek Cc: Jonathan Wakely , Marc Glisse , Nathan Sidwell , GCC Patches , Jan Hubicka References: <20200403152609.GA35629@kam.mff.cuni.cz> <0dbc191e-66f7-9878-956d-96149f20f5bf@suse.cz> <20200408133252.GG2212@tucnak> <20d175a6-23df-43e5-7027-d11fc660abd1@suse.cz> From: Jason Merrill Message-ID: Date: Thu, 9 Apr 2020 12:55:25 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.3.0 MIME-Version: 1.0 In-Reply-To: <20d175a6-23df-43e5-7027-d11fc660abd1@suse.cz> Content-Language: en-US X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-16.0 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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-List-Received-Date: Thu, 09 Apr 2020 16:55:31 -0000 On 4/9/20 1:05 AM, Martin Li=C5=A1ka wrote: > Hi. >=20 > We've got one another sneaky test-case (thank you Marc ;) ): >=20 > $ cat pr94314-array.C > #include > #include >=20 > int count =3D 0; >=20 > __attribute__((malloc, noinline)) void* operator new[](unsigned long sz) = { > =C2=A0 ++count; > =C2=A0 return ::operator new(sz); > } >=20 > void operator delete[](void* ptr) noexcept { > =C2=A0 --count; > =C2=A0 ::operator delete(ptr); > } >=20 > void operator delete[](void* ptr, std::size_t sz) noexcept { > =C2=A0 --count; > =C2=A0 ::operator delete(ptr, sz); > } >=20 > int main() { > =C2=A0 delete[] new int[1]; > =C2=A0 if (count !=3D 0) > =C2=A0=C2=A0=C2=A0 __builtin_abort (); > } >=20 > I bet we need to include the Honza's fix for inline stacks. > Or it the test-case invalid? I suppose that these inlining issues are a good reason why the standard=20 talks about new-expressions and delete-expressions rather than calls. Jason