contained subroutines called only once are not inlined, despite the fact that it is always a win (independent of the size of the contained subroutine). It 'only requires' counting the number of calls to cs1 in the routine s1, if it is 1, it should be inlined, as there can not be other callers.
example that shows no inlining at -O3 with GNU Fortran (GCC) 4.3.0 20080121 (experimental) [trunk revision 131689] SUBROUTINE S1(X) CALL CS1(X) CONTAINS SUBROUTINE CS1(X) CALL RANDOM_NUMBER(X) WRITE(6,*) X END SUBROUTINE CS1 END SUBROUTINE S1 -- Summary: contained subroutines called only once are not inlined Product: gcc Version: 4.3.0 Status: UNCONFIRMED Keywords: missed-optimization Severity: normal Priority: P3 Component: tree-optimization AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: jv244 at cam dot ac dot uk http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34940