https://gcc.gnu.org/bugzilla/show_bug.cgi?id=69080
--- Comment #3 from sv.muel...@tu-braunschweig.de --- Thanks for testing this out! Indeed there aren't any leaks with your changes. Actually, leaving the module save statement uncommented produces the same positive result for me. 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 allocatables in all other cases. Of course, I may be mistaken.