The following is invalid Fortran 95 but valid Fortran 2003 as the variable is reallocated:
integer, allocatable :: a(:) allocate(a(1)) print *, size(a) a = [1,2,3] ! Implicit reallocation. ! Wrong: a(:) = [1,2,3] ! Out of bounds 1 vs. 3 print *, size(a) end The Intel compiler already supports this option. It provides the option -assume [no]realloc_lhs to switch the support on/off. "Off" is useful for bound checks and makes the program faster as the bounds do not need to be checked in that case. See also the comp.lang.fortran post at: http://groups.google.com/group/comp.lang.fortran/browse_thread/thread/7d5d1e7f4a48071c/7c63fef65ba5ea70?lnk=gst&q=realloc_lhs -- Summary: [F2003] Automatic reallocation on assignment to allocatable variables Product: gcc Version: 4.3.0 Status: UNCONFIRMED Severity: enhancement Priority: P3 Component: fortran AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: burnus at gcc dot gnu dot org OtherBugsDependingO 20585 nThis: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=35810