From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-x336.google.com (mail-wm1-x336.google.com [IPv6:2a00:1450:4864:20::336]) by sourceware.org (Postfix) with ESMTPS id 8D1653858405; Fri, 29 Oct 2021 00:05:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 8D1653858405 Received: by mail-wm1-x336.google.com with SMTP id j128-20020a1c2386000000b003301a98dd62so2620902wmj.5; Thu, 28 Oct 2021 17:05:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=i1MbOX4WVHt+gqcCBxo1vNhGGniARZlEdaLpyuo78pg=; b=dU5bok3sR9dKLw+wQP39KpA5TVgzEqAJd+uhEUdRO2ElGgXzfsNc1S5G1YNEEaZOqG 8/7n0/LmY5B9mTzx+NpYEgVLBNrVcY1TwFxcbEjybHda+D/ta/D/C4WAj/dYdtGN5G/K 5QFiFBUFd/Cccc0l76nedG6V7X55LDkWUTO4NCEFu8WgLZ+Yql7S22YFLTEaOjEB6zI3 Z+lDFOKOZpoEa0an81QgtJ0yx+Z3x99ura9pg3Kc1x0TLWYurrAKv6YalXKFdeIpvKn2 4hW5GtxPmml711o9NF0wxXTcLrQUCAHOB8mLKNB48L1tgMIdC1tppKMrina8jz3Mus70 IKGg== X-Gm-Message-State: AOAM533QTpHgYdPpCC3+zBWtkPbkqjC5DWvryEXWBENbqdJCYELLUtZC yMT7vtMoNeFvVuMr63Ihjr8= X-Google-Smtp-Source: ABdhPJwhwiGbDQ3dSvCUpHNjAsQNIgUo1ypAHvv5lq9jyvzF1XQ5/5aopb2owjdlLBi6NIq6xKl1rQ== X-Received: by 2002:a1c:9a96:: with SMTP id c144mr7804582wme.70.1635465954452; Thu, 28 Oct 2021 17:05:54 -0700 (PDT) Received: from nbbrfq (dynamic-2bq7di4u2lfl4qjka9-pd01.res.v6.highway.a1.net. [2001:871:227:33a8:f6a3:c58c:7641:e771]) by smtp.gmail.com with ESMTPSA id v185sm7620299wme.35.2021.10.28.17.05.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Oct 2021 17:05:54 -0700 (PDT) Date: Fri, 29 Oct 2021 02:05:51 +0200 From: Bernhard Reutner-Fischer To: Tobias Burnus Cc: rep.dot.nop@gmail.com, fortran@gcc.gnu.org, Bernhard Reutner-Fischer , gcc-patches@gcc.gnu.org Subject: Re: [PATCH,FORTRAN 28/29] Free type-bound procedure structs Message-ID: <20211029020551.11a62076@nbbrfq> In-Reply-To: <20180905145732.404-29-rep.dot.nop@gmail.com> References: <20180905145732.404-29-rep.dot.nop@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-9.9 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, 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 00:05:57 -0000 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);