Reported to the fortran list by Jonathan Dursi http://gcc.gnu.org/ml/fortran/2006-02/msg00016.html
I can confirm this bug and that the source of the problem is exactly as suspected by Andrew Pinksi. A patch is on its way, which also fixes PR25103 - "Automatic object allowed in main program" and tidies up resolve_symbol. ============================================================================ In particular, this compiles: program foo integer, parameter :: len = 5 integer :: arr(max(len,1)) end wheras changing `program' to `module': module foo integer, parameter :: len = 5 integer :: arr(max(len,1)) end produces this: In file foo.F90:4 integer :: arr(max(len,1)) 1 Error: Module array 'arr' at (1) cannot be automatic or assumed shape -- Summary: Module array cannot be automatic or assumed shape Product: gcc Version: 4.2.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: fortran AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: paul dot richard dot thomas at cea dot fr http://gcc.gnu.org/bugzilla/show_bug.cgi?id=26074