Thomas points out that the attachments went AWOL - apologies. This patch fixes the problems in comments 23 and 24 of the PR. Comment 23 is fixed by the chunk in expr.c. The chunks in decl.c and resolve.c fix #24. To be quite honest, I am not sure why they were not needed in the first place! However, the changes don't cause any problems. Removing the interface bodies causes the expected error cascade. Regtests on FC33/x86_64 - OK for master and, after a decent delay 9- and 10- branches? Paul Fortran: This patch fixes comments 23 and 24 of PR96320. 2021-01-15 Paul Thomas gcc/fortran PR fortran/96320 * decl.c (gfc_match_modproc): It is not an error to find a module procedure declaration within a contains block. * expr.c (gfc_check_vardef_context): Pure procedure result is assignable. Change 'own_scope' accordingly. * resolve.c (resolve_typebound_procedure): A procedure that has the module procedure attribute is almost certainly a module procedure, whatever its interface. gcc/testsuite/ PR fortran/96320 * gfortran.dg/module_procedure_5.f90 : New test. * gfortran.dg/module_procedure_6.f90 : New test.