incorrect integer kind returned from call to storage_size() with gcc 4.9.0
N.M. Maclaren
nmm1@cam.ac.uk
Fri Jul 25 11:30:00 GMT 2014
On Jul 25 2014, Rezny, Mike wrote:
>
> 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?
No. A result is a value, and not a variable, and therefore it would
not be a bug to return a 48 bit or even a 79 bit value. That is
automatically converted to what you need except in artificial contexts
like that one.
The key property is the KIND of the result - if THAT is not KIND(0),
then there is a bug. I haven't got 4.9.0 built, buttry:
PROGRAM Main
USE ISO_FORTRAN_ENV
INTEGER, PARAMETER :: k = SELECTED_INT_KIND(18)
PRINT *, KIND(0), k, KIND(STORAGE_SIZE(0.0))
PRINT *, SIZEOF(0), SIZEOF(0_k), SIZEOF(STORAGE_SIZE(0.0))
END PROGRAM Main
Regards,
Nick Maclaren.
More information about the Fortran
mailing list