This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch, fortran] PR32124 - Don't give a run-time error if stat= has been specified for ALLOCATE


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]