public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
From: Tobias Burnus <tobias@codesourcery.com>
To: <sgk@troutmask.apl.washington.edu>,
	Paul Richard Thomas <paul.richard.thomas@gmail.com>
Cc: Thomas Koenig <tkoenig@netcologne.de>,
	"fortran@gcc.gnu.org" <fortran@gcc.gnu.org>
Subject: Re: [Patch, fortran] PR37336 finalization
Date: Wed, 8 Mar 2023 17:29:33 +0100	[thread overview]
Message-ID: <f76a8cf6-f2f5-1f74-e4b7-35ec131d8d0f@codesourcery.com> (raw)
In-Reply-To: <ZAilxFXkXq80/aWr@troutmask.apl.washington.edu>

On 08.03.23 16:12, Steve Kargl via Fortran wrote:
> For one of my codes, I see
> % foreach i (*.o)
> foreach? nm $i | grep final
> foreach? end
> 0000000000000280 T __beamsm_MOD___final_beamsm_Table_t
> 0000000000000580 T __bsam_MOD___final_bsam_Bsa_info_t
> 00000000000001e0 T __bsam_MOD___final_bsam_Bsa_t
> 00000000000000a0 T __ffn_data_MOD___final_ffn_data_Fe_t
>
> I do not explicitly use finalization nor do I have
> subprograms named __final_*.  To me, this re-inforces
> Richard's point about not breaking existing code.

I think there are two places where finalization is touched: (a) when
declaring a type, finalization procedures might get generated.(*) — And,
(b) invoking finalization procedures.

(a) happens if you have you explicitly add finalization functions – or
(I believe) when you have allocatable components as GCC may then need to
free them.

I think (b) only happens if you either have polymorphism (as then you
don't know whether the polymorphic function uses finalization) – or when
you invoke explicitly finalization.

I believe you run into (a) – the finalization generation. My
understanding is that Paul's patch is mostly about (b) and for sure not
for the default-generated procedures. But of course, any code one
touches for one purpose can still have side effects, affecting seemingly
unrelated code.

Tobias

PS: I think we should change at some point when the virtual tables and
their default procs (init, copy, finalize) generated.

Namely, instead of generating them for all types – even if not used – it
makes sense to generate them only when a type is used in CLASS(t). This
will lead to the generation in multiple translation units, but weak
symbols come to a rescue – and for a MODULE, it can be stored in the
.mod file that the vtable + funcs has been generated. That way, way
fewer vtables are generated, saving a lot of space and reducing compile
time!

-----------------
Siemens Electronic Design Automation GmbH; Anschrift: Arnulfstraße 201, 80634 München; Gesellschaft mit beschränkter Haftung; Geschäftsführer: Thomas Heurung, Frank Thürauf; Sitz der Gesellschaft: München; Registergericht München, HRB 106955

  parent reply	other threads:[~2023-03-08 16:29 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-07 13:45 Paul Richard Thomas
2023-03-07 14:58 ` Thomas Koenig
2023-03-07 17:15   ` Steve Kargl
2023-03-08  7:32   ` Paul Richard Thomas
2023-03-08  8:05     ` Thomas Koenig
2023-03-08  8:14       ` Richard Biener
2023-03-08  8:55         ` Thomas Koenig
2023-03-08  9:10           ` Richard Biener
2023-03-08 12:27             ` Paul Richard Thomas
2023-03-08 10:28           ` Tobias Burnus
2023-03-08  9:14       ` Paul Richard Thomas
2023-03-08  9:21         ` Richard Biener
2023-03-08 14:55           ` Paul Richard Thomas
2023-03-08 14:57             ` Richard Biener
2023-03-08 21:35             ` Thomas Koenig
2023-03-09  7:13               ` Thomas Koenig
2023-03-09  8:32                 ` Richard Biener
2023-03-09  8:18               ` Richard Biener
2023-03-09 12:43                 ` Paul Richard Thomas
2023-03-09 17:30                   ` Thomas Koenig
2023-03-10  3:56                     ` Jerry D
2023-03-10 16:49                     ` Paul Richard Thomas
2023-03-15  7:29                       ` Paul Richard Thomas
2023-03-15  7:37                         ` Richard Biener
2023-03-16  7:20                           ` Paul Richard Thomas
2023-03-09 15:05                 ` Steve Kargl
2023-03-08 15:12     ` Steve Kargl
2023-03-08 15:29       ` Andrew Benson
2023-03-08 16:29       ` Tobias Burnus [this message]
2023-03-08 17:12         ` Paul Richard Thomas
2023-06-02 13:42 ` Paul Richard Thomas
2023-06-03  5:50   ` Thomas Koenig
2023-06-03  7:32     ` Steve Kargl
2023-06-03 13:16     ` Paul Richard Thomas
2023-06-03 19:10       ` Harald Anlauf
2023-06-03 19:22       ` Thomas Koenig

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=f76a8cf6-f2f5-1f74-e4b7-35ec131d8d0f@codesourcery.com \
    --to=tobias@codesourcery.com \
    --cc=fortran@gcc.gnu.org \
    --cc=paul.richard.thomas@gmail.com \
    --cc=sgk@troutmask.apl.washington.edu \
    --cc=tkoenig@netcologne.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).