RFC: patch to add ISO_FORTRAN_ENV intrinsic module

Paul Thomas paulthomas2@wanadoo.fr
Mon Oct 30 21:43:00 GMT 2006


François-Xavier,

I am having some difficulty with this proposal; perhaps because I am 
ignorant on the format of the F2003 intrinsic modules.  Why is it 
necessary to have custom code for each new intrinsic module?  Would it 
not be better, as I wrote elsewhere, to have .mod files and a library in 
a special directory for intrinsic modules?  That way, the existing 
module code could be used, with the addition of your bits to sort out 
intrinsic and non-intrinsic.
> 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.
What structure has Christopher adopted?
>
>
>  -- 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
This seems OK to me.  However, are we perhaps being a bit parsimonious 
with attribute bits?  Maybe an intrinsic_module bit would be better?
>    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):
You'll have to find the module symbol, check if it's intrinsic and throw 
on the new module being non-intrinsic.
>
> 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 
...and the other way round, I suppose!

Anyway, it's impressive to see you launching into module.c - convince me 
that what you are doing is OK!

Best wishes

Paul



More information about the Gcc-patches mailing list