From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-pf1-x432.google.com (mail-pf1-x432.google.com [IPv6:2607:f8b0:4864:20::432]) by sourceware.org (Postfix) with ESMTPS id EE1BC3858410; Fri, 29 Oct 2021 14:54:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org EE1BC3858410 Received: by mail-pf1-x432.google.com with SMTP id m14so9451331pfc.9; Fri, 29 Oct 2021 07:54:23 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:cc:references:from:in-reply-to :content-transfer-encoding; bh=ECDXajxaBfVplTmYRK7U6IUeV4puSEJhYe+aAneeg98=; b=QYJ0otumMEMq43+19TXNGOGwiyRYd6N3ilyA7FhsWqrcTarxuKa4Y34jKCRerqTRSO VRtusobIjWNfKxnmhlOr7VtGauSWFeeNjUdB8YR2sQ6ZhlSGp4nWc6tp7Sgc8vwSLUdF gyKZzCD3zV8B1BsFusHWrrhdSNlSzIR32xuaG6Uds9wIbNzLD0Rbt6NNZyF+RXxxn4v7 n4JxKSEI43hnFH7hZ01rPIUFpqzxnW0S6fbT8/Qmd6pcTgleH1tCQyVfgdbxukpcMUAW nf7J51abtsc7T4RASUNzyNYbDKWkD+JV0iqh6Amhz79y6q8qFyKm64Hp5eBC3itGuOcY uX4g== X-Gm-Message-State: AOAM531JBrG4D/HxXFr0XQ5Kfw3gXo1/BdSY7hGYPXSXg/XH0Lb5KwDA hewl0qHeDvKoM4Zjpmo80ss= X-Google-Smtp-Source: ABdhPJxbnuTbzfoby7nU7W9Nn8Y4CSajfsUedj04NcvyurADo+ZZooClWyMpgqipTfadQ7k6CU0+aw== X-Received: by 2002:a05:6a00:10c3:b0:47c:305f:b318 with SMTP id d3-20020a056a0010c300b0047c305fb318mr11576550pfu.8.1635519262881; Fri, 29 Oct 2021 07:54:22 -0700 (PDT) Received: from [192.168.1.28] ([50.46.203.130]) by smtp.gmail.com with ESMTPSA id h23sm7057315pfn.109.2021.10.29.07.54.22 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 29 Oct 2021 07:54:22 -0700 (PDT) Message-ID: Date: Fri, 29 Oct 2021 07:54:21 -0700 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.2.0 Subject: Re: [PATCH,FORTRAN 28/29] Free type-bound procedure structs Content-Language: en-US To: Bernhard Reutner-Fischer , Tobias Burnus Cc: gcc-patches@gcc.gnu.org, Bernhard Reutner-Fischer , fortran@gcc.gnu.org References: <20180905145732.404-29-rep.dot.nop@gmail.com> <20211029020551.11a62076@nbbrfq> From: Jerry D In-Reply-To: <20211029020551.11a62076@nbbrfq> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-9.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, GIT_PATCH_0, NICE_REPLY_A, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on server2.sourceware.org X-BeenThere: fortran@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Fortran mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 29 Oct 2021 14:54:25 -0000 Looks good and simple. Proceed. Thanks Jerry On 10/28/21 5:05 PM, Bernhard Reutner-Fischer via Fortran wrote: > ping > [Rebased, re-regtested cleanly. Ok for trunk?] > On Wed, 5 Sep 2018 14:57:31 +0000 > Bernhard Reutner-Fischer wrote: > >> From: Bernhard Reutner-Fischer >> >> compiling gfortran.dg/typebound_proc_31.f90 leaked the type-bound >> structs: >> >> 56 bytes in 1 blocks are definitely lost. >> at 0x4C2CC05: calloc (vg_replace_malloc.c:711) >> by 0x151EA90: xcalloc (xmalloc.c:162) >> by 0x8E3E4F: gfc_get_typebound_proc(gfc_typebound_proc*) (symbol.c:4945) >> by 0x84C095: match_procedure_in_type (decl.c:10486) >> by 0x84C095: gfc_match_procedure() (decl.c:6696) >> ... >> >> gcc/fortran/ChangeLog: >> >> 2017-12-06 Bernhard Reutner-Fischer >> >> * symbol.c (free_tb_tree): Free type-bound procedure struct. >> (gfc_get_typebound_proc): Use explicit memcpy for clarity. >> --- >> gcc/fortran/symbol.c | 4 ++-- >> 1 file changed, 2 insertions(+), 2 deletions(-) >> >> diff --git a/gcc/fortran/symbol.c b/gcc/fortran/symbol.c >> index 53c760a6c38..cde34c67482 100644 >> --- a/gcc/fortran/symbol.c >> +++ b/gcc/fortran/symbol.c >> @@ -3845,7 +3845,7 @@ free_tb_tree (gfc_symtree *t) >> >> /* TODO: Free type-bound procedure structs themselves; probably needs some >> sort of ref-counting mechanism. */ >> - >> + free (t->n.tb); >> free (t); >> } >> >> @@ -5052,7 +5052,7 @@ gfc_get_typebound_proc (gfc_typebound_proc *tb0) >> >> result = XCNEW (gfc_typebound_proc); >> if (tb0) >> - *result = *tb0; >> + memcpy (result, tb0, sizeof (gfc_typebound_proc));; >> result->error = 1; >> >> latest_undo_chgset->tbps.safe_push (result);