https://gcc.gnu.org/bugzilla/show_bug.cgi?id=45337
markeggleston at gcc dot gnu.org changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |markeggleston at gcc dot gnu.org --- Comment #13 from markeggleston at gcc dot gnu.org --- Regarding patch in comment 7 and test case in comment 11. It seems to me that it is only necessary to to check for the dummy attribute: diff --git a/gcc/fortran/resolve.c b/gcc/fortran/resolve.c index 223dcccce91..730d11105bd 100644 --- a/gcc/fortran/resolve.c +++ b/gcc/fortran/resolve.c @@ -12918,8 +12918,7 @@ resolve_fl_variable (gfc_symbol *sym, int mp_flag) else if (sym->attr.external) gfc_error ("External %qs at %L cannot have an initializer", sym->name, &sym->declared_at); - else if (sym->attr.dummy - && !(sym->ts.type == BT_DERIVED && sym->attr.intent == INTENT_OUT)) + else if (sym->attr.dummy) gfc_error ("Dummy %qs at %L cannot have an initializer", sym->name, &sym->declared_at); else if (sym->attr.intrinsic) For the test case from comment 1: pr45337_1.f90:3:20: 3 | subroutine lengthX(x, i) | 1 Error: Dummy 'x' at (1) cannot have an initializer pr45337_1.f90:14:7: 14 | use ptrmod | 1 Fatal Error: Cannot open module file 'ptrmod.mod' for reading at (1): No such file or directory compilation terminated. and for the test case from comment 11: pr45337_2.f90:7:16: 7 | subroutine x(a, b, c) | 1 Error: Dummy 'a' at (1) cannot have an initializer pr45337_2.f90:7:19: 7 | subroutine x(a, b, c) | 1 Error: Dummy 'b' at (1) cannot have an initializer Regarding comments 8, 9 and 10. I think the the error messages are sufficient as is. No additional test failures encountered when running make check-fortran.