This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug fortran/80121] Memory leak with derived-type intent(out) argument


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80121

--- Comment #7 from janus at gcc dot gnu.org ---
(In reply to janus from comment #6)
> (In reply to janus from comment #5)
> > In trans-decl.c there is a function called 'init_intent_out_dt', which takes
> > care of deallocating the allocatable components of intent(out) derived-type
> > dummies. However, it has a comment saying:
> > 
> > 	/* Note: Allocatables are excluded as they are already handled
> > 	   by the caller.  */
> 
> 
> Apparently 'gfc_conv_procedure_call' in trans-expr.c does that.

My feeling is that it would be a good idea to handle allocatable derived types
inside of the callee as well. I can see at least two advantages:
* It would avoid code duplication if the procedure is called several times.
* It would take some complexity out of gfc_conv_procedure_call, which is quite
a monster.

>From the technical side a treatment in the callee should be possible AFAICS. I
wonder why it is being done in the caller at all?

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]