https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80477
--- Comment #10 from Stefano Zaghi <stefano.zaghi at cnr dot it> --- Dear all, here https://github.com/szaghi/leaks_hunter you can find my report. Into the report I shown all the test I have done, I provide the sources and the scripts I used to generate them. As FortranFan and Francesco Salvadore pointed out, it seems that a simple workaround exists: add an allocatable into types which have only static components and have polymorphic result-functions. I'll try this workaround into the real program after 25 April. I hope this report you for your patch. My best regards.