https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116359
Bug ID: 116359 Summary: Nested contained procedures rejected Product: gcc Version: 14.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran Assignee: unassigned at gcc dot gnu.org Reporter: mikael at gcc dot gnu.org Target Milestone: --- Consider this: program p contains subroutine s contains subroutine x end subroutine x end subroutine s end program It is rejected, but I couldn't find what in the standard would make it invalid. The error message is: toto.f90:4:10: 4 | contains | 1 Error: CONTAINS statement at (1) is already in a contained program unit toto.f90:6:20: 6 | end subroutine x | 1 Error: Expected label āsā for END SUBROUTINE statement at (1) The second error is an error recovery problem from the first error. The code generating the first error has been there from the dawn of times (tree-ssa merge).