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

--- Comment #6 from Dominique d'Humieres <dominiq at lps dot ens.fr> ---
> However, I don't think this is a solution. If you, for example, think
> of a string class as the derived type instead of "dummy", there could
> be a function returning an allocatable string_class derived type.
> This string function result could be used somewhere in a subroutine
> as input, but the subroutine doesn't know if the string will still be
> used outside of the subroutine. So there is no way the subroutine should
> deallocate the string.
>
> I know that allocatables that are declared in the program itself aren't
> deallocated automatically because of the implicit save attribute. 
> But my thinking was that Fortran will take care of deallocating allocatable
> in all other cases. Of course, I may be mistaken.

Well, if the user is unable to decide when and where something should be
deallocate, how can you expect the compiler to do better? AFAIU this should be
handled through finalization, but I am still learning and I am not in position
to give advice in this area.

Reply via email to