This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [gfortran,patch] add ISO_FORTRAN_ENV intrinsic module


François-Xavier Coudert wrote:
> [ http://gcc.gnu.org/ml/gcc-patches/2006-10/msg01593.html ]
>> Updated patch, including testsuite coverage, attached. Regtested on
>> i686-linux. Any new comments anyone? OK for mainline?

+                 gfc_error ("Module nature in USE statement at %C should "
+                            "be either INTRINSIC or NON_INTRINSIC");
I would use "shall" rather than "should".


Besides I get currently the warning (treated as error):
In file included from /home/tob/projects/gcc/gcc/fortran/module.c:3872:
gcc/gcc/fortran/iso-fortran-env.def: In function
'use_iso_fortran_env_module':
gcc/gcc/fortran/iso-fortran-env.def:28: warning: initializer element is
not computable at load time
gcc/gcc/fortran/iso-fortran-env.def:28: warning: initializer element is
not computable at load time
gcc/gcc/fortran/iso-fortran-env.def:35: warning: initializer element is
not computable at load time
gcc/gcc/fortran/iso-fortran-env.def:35: warning: initializer element is
not computable at load time

NAMED_INTCST (ISOFORTRANENV_CHARACTER_STORAGE_SIZE,
"character_storage_size", \
              gfc_character_storage_size)

NAMED_INTCST (ISOFORTRANENV_NUMERIC_STORAGE_SIZE, "numeric_storage_size", \
              gfc_numeric_storage_size)

If I see it correctly, the values get set to 4*8 (respectively to 8) at
runtime (depending on the flags) in trans-types.c's gfc_init_kinds.

minit is: #define minit(s, t) { s, NULL, t }.

And it is used as:
  const mstring symbol[] = {
#define NAMED_INTCST(a,b,c) minit(b,c),
#include "iso-fortran-env.def"
#undef NAMED_INTCST
    minit (NULL, -1234) };

At the moment I fail to see how it could have worked.

* * *

Using constants in iso*def, I did some practical tests.
Result: Error checking goes wrong. I get the following error for -std=f95:

 use test
   1
Error: New in Fortran 2003: "USE :: module" at (1)

Otherwise, the module works ok.



Maybe one should give a better error message for:

 use, intrinsic iso_fortran_env
1
Error: Unclassifiable statement at (1)

This usage is invalid in Fortran 2003, however g95, NAG f95 and ifort
accept this and if it works with several compilers and you see this
message with the gfortran, you may wrongly assume either that gfortran
has a bug or does not support (non_)intrinsic.
Suggested fix: Accept it with -std=gnu, reject it with a nice error with
-std=f2003.

Tobias


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]