RFC: patch to add ISO_FORTRAN_ENV intrinsic module
François-Xavier Coudert
fxcoudert@gmail.com
Thu Oct 26 15:14:00 GMT 2006
Hi all,
Attached patch adds the intrinsic ISO_FORTRAN_ENV module to gfortran,
as well as general support for intrinsic modules and the F2003-style
USE statement. I first thought this might wait until the ISO_C_BINDING
module is added, but seeing that Christopher encounters problems with
his paperwork, we agreed it's best to submit it now, and then it will
be relatively easy to change his patch (I volunteer to do it) to use
the framework I'm proposing here.
I'm not submitting this patch for formal review yet, because of a few
questions I'd like your opinion about. The patch mostly works, but for
the following testcases:
-- I think CHARACTER_STORAGE_SIZE and FILE_STORAGE_SIZE have value 8
on all the systems we currently support. For NUMERIC_STORAGE_SIZE,
however, I'm not sure what to do. The standard says "The value of the
default integer scalar constant NUMERIC STORAGE SIZE is the size
expressed in bits of the numeric storage unit (16.4.3.1)." Then
16.4.3.1 says "A nonpointer scalar object of type default integer,
default real, or default logical occupies a single numeric storage
unit". Now the question is:
When the compiler is used with -fdefault-real-8 or -fdefault-integer-8
(but not both), what the heck should the value of NUMERIC_STORAGE_SIZE
be?
-- I've used the attr.intrinsic bit for the module symbol to
specifiy that it's an intrinsic module. Except one line in resolve.c
(see diff), it seems to be safe. However, I'd like
a) to be sure that, for every user module symbol created, the
intrinsic bit is set to 0, so that we check that a non-intrinsic and
an intrinsic module of the same name aren't used
b) the code USEing non-intrinsic modules (in module.c) to issue an
error if an intrinsic module of the same name was already USEd; ie,
I'd like the following to error out (while, with my patch, it does
not):
module iso_fortran_env
end module iso_fortran_env
program foo
use, intrinsic :: iso_fortran_env
use, non_intrinsic :: iso_fortran_env ! This should issue an error
end program foo
Of course, any other comments are welcome!
FX
-------------- next part --------------
A non-text attachment was scrubbed...
Name: iso_fortran_env.ChangeLog
Type: application/octet-stream
Size: 538 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20061026/c3c5ae9f/attachment.obj>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: iso_fortran_env.diff
Type: text/x-patch
Size: 8490 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20061026/c3c5ae9f/attachment.bin>
More information about the Fortran
mailing list