Runtime error

Salvatore Filippone salvatore.filippone@uniroma2.it
Mon May 28 09:25:00 GMT 2007


To be more precise, my copy of M&R&C says: "if stat= is absent and the
allocation is unsuccessgul, program execution stops"
which implies, to me, that if stat= is present the it should NOT stop,
and thus the following program should print its own message. Whether
gfortran's own message should be printed or not is somewhat beside the
point... 
Thanks

[sfilippo@localhost bugtest]$ gfortran -v
Using built-in specs.
Target: i686-pc-linux-gnu
Configured with: ../gcc-4.2.0/configure --prefix=/usr/local/gcc42
--with-mpfr=/home/travel/GCC/BUILDS/mpfr
--with-gmp-lib=/home/travel/GCC/BUILDS/gmp/lib/
--with-gmp=/home/travel/GCC/BUILDS/gmp
Thread model: posix
gcc version 4.2.0
[sfilippo@localhost bugtest]$ gfortran  -o tryalloc tryalloc.f90 
[sfilippo@localhost bugtest]$ ./tryalloc 
Fortran runtime error: Attempt to allocate negative amount of memory.
Possible integer overflow
[sfilippo@localhost bugtest]$ more tryalloc.f90 
program tryalloc
  real(kind(1.d0)), allocatable :: x(:,:)
  integer :: info
  
  allocate(x(100000,100000),stat=info)
  
  write(*,*) 'Should reach this and report a nonzero (failure) ',info
  
  
end program tryalloc

-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/x-pkcs7-signature
Size: 1614 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20070528/9c3fd693/attachment.bin>


More information about the Fortran mailing list