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: RFC: patch to add ISO_FORTRAN_ENV intrinsic module


François-Xavier Coudert wrote:
  -- 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?

Well, when the compiler is used with one or the other (but not both) of those options, it's not a standard-comforming Fortran compiler, so the standard is quite silent on the matter. The proper behavior is left up to us as a matter of opinion.


Personally, since in that case NUMERIC_STORAGE_SIZE does not have any consistent meaning, I'd prefer for any references to it to throw an error. I imagine that throwing a specific descriptive error would be difficult, but would it be possible to simply leave it undefined in that case? If so, that would be my recommendation.

Alternately, I'd be tempted to give it some sort of obviously erroneous value like -HUGE(1). I'm not convinced of the wisdom of that, though.

In any case, no matter what we do, any user code that uses it in that sort of situation has at least a 50% chance of getting a wrong answer. I think it's better to make the wrongness obvious, even at the expense of losing the 50% of times that it happens by luck to do the right thing.

- Brooks


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