From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4543 invoked by alias); 25 Nov 2018 08:44:56 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 4532 invoked by uid 89); 25 Nov 2018 08:44:55 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=4.9 required=5.0 tests=BAYES_00,GARBLED_SUBJECT,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_LOW autolearn=no version=3.3.2 spammy=decl, vtable, destructor, translation X-HELO: mx-relay09-hz1.antispameurope.com Received: from mx-relay09-hz1.antispameurope.com (HELO mx-relay09-hz1.antispameurope.com) (94.100.132.209) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sun, 25 Nov 2018 08:44:53 +0000 Return-Path: Received: from s041.bre.qsc.de ([195.90.7.81]) by mx-relay09-hz1.antispameurope.com; Sun, 25 Nov 2018 09:44:50 +0100 Received: from tux.net-b.de (port-92-195-151-243.dynamic.qsc.de [92.195.151.243]) by s041.bre.qsc.de (Postfix) with ESMTPSA id EEB522C02F7; Sun, 25 Nov 2018 09:44:49 +0100 (CET) Subject: =?UTF-8?Q?*ping*_=e2=80=93_PR_C++/88114_-_PATCH_for_destructor_not_?= =?UTF-8?Q?generated_for_=22virtual_=7edestructor=28=29_=3d_default=22?= To: Tobias Burnus , gcc-patches@gcc.gnu.org References: <20181121121935.tm4y2wyie6bc72sn@physik.fu-berlin.de> From: Tobias Burnus Message-ID: <7aa0a107-0595-adc1-9cce-d41b953846e3@net-b.de> Date: Sun, 25 Nov 2018 08:44:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.1 MIME-Version: 1.0 In-Reply-To: <20181121121935.tm4y2wyie6bc72sn@physik.fu-berlin.de> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Transfer-Encoding: 7bit X-cloud-security-sender:burnus@net-b.de X-cloud-security-recipient:gcc-patches@gcc.gnu.org X-cloud-security-Virusscan:CLEAN X-cloud-security-disclaimer: This E-Mail was scanned by E-Mailservice on mx-relay09-hz1.antispameurope.com with 3713320BC8132 X-cloud-security-connect: s041.bre.qsc.de[195.90.7.81], TLS=1, IP=195.90.7.81 X-cloud-security:scantime:.1828 X-SW-Source: 2018-11/txt/msg02028.txt.bz2 On 21 November 2018, Tobias Burnus wrote: > Hello all, > > if a class contains any 'virtual ... = 0', it's an abstract class and for an > abstract class, the destructor not added to the vtable. > > For a normal > virtual ~class() { } > that's not a problem as the class::~class() destructor will be generated during > the parsing of the function. > > But for > virtual ~class() = default; > the destructor will be generated via mark_used via the vtable. > > > If one now declares a derived class and uses it, the class::~class() is generated > in that translation unit. Unless, #pragma interface/implementation is used. > > In that case, the 'default' destructor will never be generated. > > > The following code seems to work both for the big code and for the example; > without '#pragma implementation', the destructor is not generated for the example, > only with. > > The patch survived boostrapping GCC with default languages on x86-64-gnu-linux > and "make check-g++".* > > [One probably could get rid of some of the conditions for generating the code, > e.g. TREE_USED and DECL_DEFAULTED_FN are probably not both needed; one might > want to set some additional DECL to the fn decl.] > > Does the patch and the test case make sense? Or is something else/in addition > needed? > > Tobias > > > *I do get the following failures on this CentOS6 system: > > FAIL: g++.dg/pr83239.C -std=gnu++98 (test for excess errors) > Excess errors: > cc1plus: warning: 'void* __builtin_memset(void*, int, long unsigned int)' specified size 18446744073709551608 exceeds maximum object size 9223372036854775807 [-Wstringop-overflow=] > cc1plus: warning: 'void* __builtin_memset(void*, int, long unsigned int)' specified size 18446744073709551600 exceeds maximum object size 9223372036854775807 [-Wstringop-overflow=] > > FAIL: g++.dg/tls/thread_local-order2.C -std=c++14 execution test > FAIL: g++.dg/tls/thread_local-order2.C -std=c++17 execution test > > plus each 32 times: > FAIL: guality/guality.h: 0 PASS, 1 FAIL, 0 UNRESOLVED > FAIL: guality/guality.h: varl is -1, not 6