https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112407
--- Comment #3 from Tomáš Trnka <trnka at scm dot com> --- Yes, -frecursive makes the build pass and it is a workaround which I have been using ever since upgrading to 13. Should have mentioned that, sorry. I see that something is making the compiler think the routine is recursive, even though it very clearly is not. The full original source of that module is available from https://github.com/SCM-NV/ftl/blob/master/src/ftlDynArray.F90_template, but even if I make the two affected routines (NewCopyOther and AssignOther) completely empty, the issue persists: subroutine NewCopyOther(self, other) class(CAT(ftlDynArray,FTL_TEMPLATE_TYPE_NAME)), intent(out) :: self type(CAT(ftlDynArray,FTL_TEMPLATE_TYPE_NAME)), intent(in) :: other end subroutine impure elemental subroutine AssignOther(self, other) class(CAT(ftlDynArray,FTL_TEMPLATE_TYPE_NAME)), intent(inout) :: self type(CAT(ftlDynArray,FTL_TEMPLATE_TYPE_NAME)), intent(in) :: other end subroutine So it looks like the compiler got confused for some reason. That's why I don't feel just using -frecursive is a valid long-term solution, because it feels like purely masking the symptoms but who knows what else is affected by the confusion. I'll test the patch shortly.