incorrect integer kind returned from call to storage_size() with gcc 4.9.0

Rezny, Mike mike.rezny@metoffice.gov.uk
Fri Jul 25 10:47:00 GMT 2014


Hi,
I am seeing the following problems in using the Fortran intrinsic function, storage_size(), in gfortran version 4.9.0.
1: A calls to this function is returning a 64-bit integer instead of a default 32-bit integer
2: the routine is not honouring the second parameter to the call which specifies the kind of the returned value.
In all valid cases, the returned value is a 64-bit integer.

I have looked through the bug list but can not see that this is a reported problem.

Am I correct in suggesting that these are compiler bugs?

Here is a small test code that demonstrates the problem:

program test1
use iso_fortran_env
implicit none
real :: x

print *, 'Size of return from storage_size(x)       ', sizeof(storage_size(x))
print *, 'Size of return from storage_size(x, int8) ', sizeof(storage_size(x, int8))
print *, 'Size of return from storage_size(x, int16)', sizeof(storage_size(x, int16))
print *, 'Size of return from storage_size(x, int32)', sizeof(storage_size(x, int32))
print *, 'Size of return from storage_size(x, int64)', sizeof(storage_size(x, int64))

end program test1

$ gfortran  -c test1.f90
$ gfortran  -o test1 test1.o
$ ./test1
 Size of return from storage_size(x)                           8
 Size of return from storage_size(x, int8)                     8
 Size of return from storage_size(x, int16)                    8
 Size of return from storage_size(x, int32)                    8
 Size of return from storage_size(x, int64)                    8

$ gfortran -v
Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/net/data/cr1/mhambley/modules/packages/gcc/4.9.0/bin/../libexec/gcc/x86_64-unknown-linux-gnu/4.9.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: ../gcc-4.9.0/configure --prefix=/data/cr1/mhambley/modules/packages/gcc/4.9.0 --disable-multilib
Thread model: posix
gcc version 4.9.0 (GCC) 

kindest regards
Mike

Dr. Mike Rezny
Model Framework Developer          Expert Scientific Software Engineer
Met Office  Fitzroy Road  Exeter  Devon  EX1 3PB  United Kingdom 
Tel:+44 (0)1392 88 6236
Mike.Rezny@metoffice.gov.uk       http://www.metoffice.gov.uk



More information about the Fortran mailing list