iso_fortran_env

View: New views
8 Messages — Rating Filter:   Alert me  

iso_fortran_env

by Vivek Rao :: Rate this Message:

| View Threaded | Show Only this Message

For Lahey/Fujitsu Fortran for Linux, the values of the
constants in the ISO_FORTRAN_ENV module are shown
below. I'd like to write an analogous module that I
can use in gfortran, until the module is implemented
in the compiler. What would the values be, for
gfortran on Windows -- i386-pc-mingw32? Thanks.
 
module ISO_FORTRAN_ENV

  ! Nonintrinsic version for Lahey/Fujitsu Fortran for
Linux.
  ! See Subclause 13.8.2 of the Fortran 2003 standard.

  implicit NONE
  public

  integer, parameter :: Character_Storage_Size = 8
  integer, parameter :: Error_Unit = 0
  integer, parameter :: File_Storage_Size = 8
  integer, parameter :: Input_Unit = 5
  integer, parameter :: IOSTAT_END = -1
  integer, parameter :: IOSTAT_EOR = -2
  integer, parameter :: Numeric_Storage_Size = 32
  integer, parameter :: Output_Unit = 6

end module ISO_FORTRAN_ENV


Re: iso_fortran_env

by Steve Kargl :: Rate this Message:

| View Threaded | Show Only this Message

On Tue, Aug 29, 2006 at 08:52:44AM -0700, Vivek Rao wrote:

> For Lahey/Fujitsu Fortran for Linux, the values of the
> constants in the ISO_FORTRAN_ENV module are shown
> below. I'd like to write an analogous module that I
> can use in gfortran, until the module is implemented
> in the compiler. What would the values be, for
> gfortran on Windows -- i386-pc-mingw32? Thanks.
>  
> module ISO_FORTRAN_ENV
>
>   ! Nonintrinsic version for Lahey/Fujitsu Fortran for
> Linux.
>   ! See Subclause 13.8.2 of the Fortran 2003 standard.
>
>   implicit NONE
>   public
>
>   integer, parameter :: Character_Storage_Size = 8
>   integer, parameter :: Error_Unit = 0
>   integer, parameter :: File_Storage_Size = 8
>   integer, parameter :: Input_Unit = 5
>   integer, parameter :: IOSTAT_END = -1
>   integer, parameter :: IOSTAT_EOR = -2
>   integer, parameter :: Numeric_Storage_Size = 32
>   integer, parameter :: Output_Unit = 6
>
> end module ISO_FORTRAN_ENV

Everthing above matches gfortran with the possible exception of
File_Storage_Size and Numeric_Storage_Size.  I don't F2003
handy.  What do these values means?

--
Steve

Re: iso_fortran_env

by Janne Blomqvist-2 :: Rate this Message:

| View Threaded | Show Only this Message

Steve Kargl wrote:

> On Tue, Aug 29, 2006 at 08:52:44AM -0700, Vivek Rao wrote:
>> For Lahey/Fujitsu Fortran for Linux, the values of the
>> constants in the ISO_FORTRAN_ENV module are shown
>> below. I'd like to write an analogous module that I
>> can use in gfortran, until the module is implemented
>> in the compiler. What would the values be, for
>> gfortran on Windows -- i386-pc-mingw32? Thanks.
>>  
>> module ISO_FORTRAN_ENV
>>
>>   ! Nonintrinsic version for Lahey/Fujitsu Fortran for
>> Linux.
>>   ! See Subclause 13.8.2 of the Fortran 2003 standard.
>>
>>   implicit NONE
>>   public
>>
>>   integer, parameter :: Character_Storage_Size = 8
>>   integer, parameter :: Error_Unit = 0
>>   integer, parameter :: File_Storage_Size = 8
>>   integer, parameter :: Input_Unit = 5
>>   integer, parameter :: IOSTAT_END = -1
>>   integer, parameter :: IOSTAT_EOR = -2
>>   integer, parameter :: Numeric_Storage_Size = 32
>>   integer, parameter :: Output_Unit = 6
>>
>> end module ISO_FORTRAN_ENV
>
> Everthing above matches gfortran with the possible exception of
> File_Storage_Size and Numeric_Storage_Size.  I don't F2003
> handy.  What do these values means?

IIRC file storage size is the number of bits per storage element. E.g.
when you do a inquire(iolength) you get the answer as an integer
multiple of the file storage size. Analogously, numeric storage size is
the size in bits of a scalar variable of default kind.

Or something like that, I'm too lazy to look into F2003 atm.



--
Janne Blomqvist

Re: iso_fortran_env

by Brooks Moses-2 :: Rate this Message:

| View Threaded | Show Only this Message

Steve Kargl wrote:

> On Tue, Aug 29, 2006 at 08:52:44AM -0700, Vivek Rao wrote:
>>  integer, parameter :: Character_Storage_Size = 8
>>  integer, parameter :: Error_Unit = 0
>>  integer, parameter :: File_Storage_Size = 8
>>  integer, parameter :: Input_Unit = 5
>>  integer, parameter :: IOSTAT_END = -1
>>  integer, parameter :: IOSTAT_EOR = -2
>>  integer, parameter :: Numeric_Storage_Size = 32
>>  integer, parameter :: Output_Unit = 6
>>
>>end module ISO_FORTRAN_ENV
>
> Everthing above matches gfortran with the possible exception of
> File_Storage_Size and Numeric_Storage_Size.  I don't F2003
> handy.  What do these values means?

They're the size, in bits, of file storage units and numeric storage
units, respectively.

9.2.4: "A file storage unit is the basic unit of storage in a stream
file or an unformatted record file. It is the unit of file position for
stream access, the unit of record length for unformatted files, and the
unit of file size for all external files."

16.4.3.1: "A nonpointer scalar object of type default integer, default
real, or default logical occupies a single numeric storage unit....  A
nonpointer scalar object of type double precision real or default
complex occupies two contiguous numeric storage units...."

- Brooks


Re: iso_fortran_env

by Brooks Moses-2 :: Rate this Message:

| View Threaded | Show Only this Message

Janne Blomqvist wrote:
> Steve Kargl wrote:
>>Everthing above matches gfortran with the possible exception of
>>File_Storage_Size and Numeric_Storage_Size.  I don't F2003
>>handy.  What do these values means?
>
> IIRC file storage size is the number of bits per storage element. E.g.
> when you do a inquire(iolength) you get the answer as an integer
> multiple of the file storage size.

No -- when you do an INQUIRE(IOLENGTH=), you get the answer in units of
the file storage unit.  If you want the answer in units of bits, you
have to multiply it by file_storage_size yourself.

That is, for a 32-bit default integer, and an 8-bit file storage unit,
INQUIRE(IOLENGTH=J) I, for I declared as default integer, will normally
result in J=4.

- Brooks


Re: iso_fortran_env

by Steve Kargl :: Rate this Message:

| View Threaded | Show Only this Message

On Tue, Aug 29, 2006 at 02:31:39PM -0700, Brooks Moses wrote:

> Steve Kargl wrote:
> >On Tue, Aug 29, 2006 at 08:52:44AM -0700, Vivek Rao wrote:
> >> integer, parameter :: Character_Storage_Size = 8
> >> integer, parameter :: Error_Unit = 0
> >> integer, parameter :: File_Storage_Size = 8
> >> integer, parameter :: Input_Unit = 5
> >> integer, parameter :: IOSTAT_END = -1
> >> integer, parameter :: IOSTAT_EOR = -2
> >> integer, parameter :: Numeric_Storage_Size = 32
> >> integer, parameter :: Output_Unit = 6
> >>
> >>end module ISO_FORTRAN_ENV
> >
> >Everthing above matches gfortran with the possible exception of
> >File_Storage_Size and Numeric_Storage_Size.  I don't F2003
> >handy.  What do these values means?
>
> They're the size, in bits, of file storage units and numeric storage
> units, respectively.
>
> 9.2.4: "A file storage unit is the basic unit of storage in a stream
> file or an unformatted record file. It is the unit of file position for
> stream access, the unit of record length for unformatted files, and the
> unit of file size for all external files."
>
> 16.4.3.1: "A nonpointer scalar object of type default integer, default
> real, or default logical occupies a single numeric storage unit....  A
> nonpointer scalar object of type double precision real or default
> complex occupies two contiguous numeric storage units...."
>

Thanks.  AFAIK, gfortran matches the above module.

--
Steve

Re: iso_fortran_env

by Richard E Maine :: Rate this Message:

| View Threaded | Show Only this Message


On Aug 29, 2006, at 2:35 PM, Brooks Moses wrote:

> Janne Blomqvist wrote:
>> Steve Kargl wrote:
>>> Everthing above matches gfortran with the possible exception of
>>> File_Storage_Size and Numeric_Storage_Size.  I don't F2003
>>> handy.  What do these values means?
>> IIRC file storage size is the number of bits per storage element.  
>> E.g. when you do a inquire(iolength) you get the answer as an  
>> integer multiple of the file storage size.
>
> No -- when you do an INQUIRE(IOLENGTH=), you get the answer in  
> units of the file storage unit.  If you want the answer in units of  
> bits, you have to multiply it by file_storage_size yourself.

I think the two of you just said the same thing in slightly different  
words. You probably misread what Janne wrote.

Back to the original question. I think that the values are probably  
right for most gfortran ports, but it might depend on the particular  
port. I know that g95 has some 64-bit ports where the numeric storage  
unit is 64 bits instead of 32. I forget whether gfortran has similar  
ports, but it seems plausible. I also forget whether there is a  
command-line switch like some compilers have for that.

--
Richard Maine                |  Good judgment comes from experience;
Richard.Maine@...       |  experience comes from bad judgment.
                             |        -- Mark Twain


This morning's commit

by Paul Thomas-10 :: Rate this Message:

| View Threaded | Show Only this Message

Steve,

I am taking it upon myself to commit the two patches that I posted
yesterday:

http://gcc.gnu.org/ml/fortran/2006-08/msg00409.html
http://gcc.gnu.org/ml/fortran/2006-08/msg00406.html

I am doing this because both are regression fixes and, being real
pressed for time, I just have to get on and help Erik out with TR15581.
They are in the late stages of regtesting on FC5, as I write.

I am getting the feeling that with these rather more subtle fixes that
the best way to proceed is to expose them to as many users as possible
and pick up the pieces afterwards. If you can do your all-of-f95 test,
at your convenience, I would be grateful.

All the best

Paul