https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109500
--- Comment #13 from Steve Kargl <sgk at troutmask dot apl.washington.edu> --- On Wed, Apr 19, 2023 at 05:25:20PM +0000, leandro.lupori at linaro dot org wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109500 > > I'm trying to check with the issue reporter how extensive is his usage of this > extension and how much effort it would require for him to avoid using it. > It's not an extension. It is a bug in the original Fortran code. The Fortran standard requires a function result to be available at the completion of execution of a function reference. The code in the original bug report clearly violates this. Note 1 in Fortran 2023, Sec. 8.5.3, p. 100, is non-normative text. I suppose one can claim that gfortran should throw an error when a function result is marked with the allocatable attribute. Unfortunately, it is likely a catch-22 situation in that gfortran needs to know the function result is allocatable so it can do the allocaton within the function, but it is not an allocatable outside of the function. Not sure gfortran can mark an internal symbol to do both.