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 Fix PR 20058


Tobias Schlüter wrote:

Steve Kargl wrote:

/* Match a binary, octal or hexadecimal constant that can be found in
-   a DATA statement.  */
+   a DATA statement.  In section 5.2.5 and following C567 we find "If a
+   data-stmt-constant is a boz-literal-constant, the corresponding variable
+   shall be of type integer.  The boz-literal-constant is treated as if it
+   were an int-literal-constant with a kind-param that specifies the
+   representation method with the largest decimal exponent range supported
+   by the processor."  */

You should probably say that this is from the F2K standard.  I'm also curious
what edition you have, and where you got it.  In my Sep 2002 draft there's a
lot of stuff between C567 and this restriction.

It all started by the following remarks by our esteemed Editor of the Fortran 2003 Standard, Richard Maine (in paper 02-102.txt for meeting 160, February, 25 - March, 1, 2002):


issue 351 - boz and REAL

      The above expression for the result of boz arguments to
      REAL does not give a reasonable result for anything other
      than default real.  The INT(A) gives a default integer
      result, which then doesn't TRANSFER reasonably to anything
      other than a default real.

      If I may make a suggestion, perhaps we should use a
      different descriptive model.  We seem to be somewhat unable
      to decide on what a boz actually is.  I've been assuming
      that a boz constant was of type integer.  They are, after
      all, described in the section on integer types.  But on
      closer reading, I don't see that we actually say they are
      of type integer.  We do say in a few places that they are
      interpreted as if they were, but we don't say that they
      actually are.  The edits of paper 01-394r1 clearly don't
      consider boz literals to actually be of type integer - if
      so, it would be nonsense to say that the arguments to, for
      example the INT intrinsic, could be "of type integer, real,
      or complex, or a boz-literal-constant."

      Treating boz constants as integers is going to make it
      difficult to use them on intrinsic reals larger than the
      largest supported integer kind.  Lots of processors have
      this situation.  It is common for the largest supported
      integer to be 32 bits, yet have 64-bit reals.  Some
      processors support 64-bit integers, but then many of those
      also support 128-bit reals.  EVen if we stick to the
      integers, there is the problem of representing negative
      integers of the largest supported integer kind.

Hope this helps,

--
Toon Moene - e-mail: toon@moene.indiv.nluug.nl - phone: +31 346 214290
Saturnushof 14, 3738 XG  Maartensdijk, The Netherlands
Maintainer, GNU Fortran 77: http://gcc.gnu.org/onlinedocs/g77_news.html
A maintainer of GNU Fortran 95: http://gcc.gnu.org/fortran/


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