public inbox for fortran@gcc.gnu.org
 help / color / mirror / Atom feed
From: Mikael Morin <morin-mikael@orange.fr>
To: Harald Anlauf <anlauf@gmx.de>, fortran <fortran@gcc.gnu.org>,
	gcc-patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] Fortran: fixes for procedures with ALLOCATABLE,INTENT(OUT) arguments [PR92178]
Date: Tue, 4 Jul 2023 21:37:06 +0200	[thread overview]
Message-ID: <3e31cc66-b7ae-adb0-f1a8-18b8bcc11c46@orange.fr> (raw)
In-Reply-To: <f5110257-a266-96ce-611c-279dfac1a6c6@gmx.de>

Le 04/07/2023 à 21:00, Harald Anlauf a écrit :
> Hi Mikael, all,
> 
> I think I've found it: there is a call to gfc_conv_class_to_class
> that - according to a comment - does a repackaging to a class array.
> Deferring that repackaging along with the deallocation not only fixes
> the regression, but also the cases I tested.
> 
> Attached is a "sneak preview", hoping that the experts (Paul, Mikael,
> ...) can tell if I am going down the wrong road.
> 
I think that's it mostly.  There is one last thing that I am not sure...

> diff --git a/gcc/fortran/trans-expr.cc b/gcc/fortran/trans-expr.cc
> index 16e8f037cfc..a68c8d33acc 100644
> --- a/gcc/fortran/trans-expr.cc
> +++ b/gcc/fortran/trans-expr.cc
> @@ -6858,6 +6860,10 @@ gfc_conv_procedure_call (gfc_se * se, gfc_symbol * sym,
>  				     && e->symtree->n.sym->attr.optional,
>  				     CLASS_DATA (fsym)->attr.class_pointer
>  				     || CLASS_DATA (fsym)->attr.allocatable);
> +
> +	      /* Defer repackaging after deallocation.  */
> +	      if (defer_repackage)
> +		gfc_add_block_to_block (&dealloc_blk, &parmse.pre);
>  	    }
>  	  else
>  	    {

... whether you will not be deferring too much here.  That is parmse.pre 
contains both the argument evaluation and the class container setup from 
gfc_conv_class_to_class.  If it's safe to defer both, that's fine, 
otherwise a separate gfc_se struct should be passed to 
gfc_conv_class_to_class so that only the latter part can be deferred.
Need to think of an example...

  reply	other threads:[~2023-07-04 19:37 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-07-02 20:38 Harald Anlauf
2023-07-03 11:46 ` Mikael Morin
2023-07-03 20:49   ` Harald Anlauf
2023-07-03 23:56     ` Steve Kargl
2023-07-04  9:26       ` Mikael Morin
2023-07-04 15:50         ` Steve Kargl
2023-07-04 13:35     ` Mikael Morin
2023-07-04 19:00       ` Harald Anlauf
2023-07-04 19:37         ` Mikael Morin [this message]
2023-07-05 14:54           ` Mikael Morin
2023-07-05 20:36             ` Harald Anlauf
2023-07-07 12:21               ` Mikael Morin
2023-07-07 18:23                 ` Harald Anlauf
2023-07-08 12:07                   ` Mikael Morin
2023-07-08 14:20                     ` Harald Anlauf

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=3e31cc66-b7ae-adb0-f1a8-18b8bcc11c46@orange.fr \
    --to=morin-mikael@orange.fr \
    --cc=anlauf@gmx.de \
    --cc=fortran@gcc.gnu.org \
    --cc=gcc-patches@gcc.gnu.org \
    /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).