https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109500
--- Comment #5 from Leandro Lupori <leandro.lupori at linaro dot org> --- Ok, thanks for the detailed explanations. Now I see that the standard doesn't allow the return of an unallocated value. This can be closed as invalid. But may I just ask a last related question? As mentioned in the last comment and according to Note 1 in F2018 8.5.3 ALLOCATABLE attribute, the result of referencing a function cannot be used as an allocatable argument. This is however allowed by gfortran (and ifort), with the exception of intrinsic procedures, and seems to work correctly. Should this be considered an extension or does it just work by accident and there are no guarantees at all when using it?