[patch, fortran] PR32124 - Don't give a run-time error if stat= has been specified for ALLOCATE
Tobias Burnus
burnus@net-b.de
Tue May 29 19:28:00 GMT 2007
Hi,
Brooks Moses wrote:
> This test is failing on powerpc-apple-darwin8.9.0; both of the status
> variables are 0.
I assume the following happens: The variable overflows such that it is a
relatively small number. malloc sees this number, allocate some memory
and returns.
For reach rank, the bounds are representable and lbound/ubound print
something meaningful, but accessing the array might cause problems
(depending which variable overflows how).
On my system it fails because the number overflows such that it is
negative, which is then detected.
Have a look in the dump at the size variable, passed to _gfortran_allocate*.
My problem is: How to get a negative number on both 32bit and 64bit
system. For 32bit the following is negative:
real(8), allocatable :: A(:)
allocate(A(huge(0_4)/7))
end
But on 64bit systems it is not and the system migher actually attempt to
allocate that much memory. Using 0_8 gives an overflow on 32bit systems
and gfortran might not compile the program.
Any ideas? (I knew why I did not want to have a test case when I
originally submitted the patch.)
Tobias
More information about the Fortran
mailing list