Based on
http://groups.google.com/group/comp.lang.fortran/browse_frm/thread/c46c14d9d8879bad/14517cbe22d222bc#14517cbe22d222bc
If one uses an array with a upper bound lower than the lower bound, the array
contains zero items. However, gfortran tries to allocate negative MEMORY when
one uses this.
Example:
-----
program xint_func
print *, 'intfunc', -1, int_func(-3)
contains
function int_func(n) result(ivec)
integer, intent(in) :: n
integer :: ivec(n)
integer :: i
forall (i=1:n) ivec(i) = i
end function int_func
end program xint_func
-----
This produces in gfortran:
Fortran runtime error: Attempt to allocate a negative amount of memory.
intfunc -1
Tested with 4.2.0 20060612 (experimental) and 4.1.0 (SUSE Linux).
--
Summary: Negative-sized array should be empty array, not try to
allocate negative memory
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: fortran
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: tobias dot burnus at physik dot fu-berlin dot de
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=28006