From f8e36f0aef5f867fdde0a1abff5bbc66c17a6429 Mon Sep 17 00:00:00 2001 From: "Steven G. Kargl" Date: Wed, 4 Sep 2019 03:43:40 +0000 Subject: [PATCH] gfortran.texi: Update documentation to catch up with BOZ changes. 2019-09-03 Steven G. Kargl * gfortran.texi: Update documentation to catch up with BOZ changes. * invoke.texi: Fix English from previous BOZ changes commit. From-SVN: r275364 --- gcc/fortran/ChangeLog | 5 ++++ gcc/fortran/gfortran.texi | 50 +++++++++++++-------------------------- gcc/fortran/invoke.texi | 4 ++-- 3 files changed, 24 insertions(+), 35 deletions(-) diff --git a/gcc/fortran/ChangeLog b/gcc/fortran/ChangeLog index 065099a62d9..b866cdf3b98 100644 --- a/gcc/fortran/ChangeLog +++ b/gcc/fortran/ChangeLog @@ -1,3 +1,8 @@ +2019-09-03 Steven G. Kargl + + * gfortran.texi: Update documentation to catch up with BOZ changes. + * invoke.texi: Fix English from previous BOZ changes commit. + 2019-09-02 Paul Thomas PR fortran/91589 diff --git a/gcc/fortran/gfortran.texi b/gcc/fortran/gfortran.texi index 22d42f49935..02d30e19660 100644 --- a/gcc/fortran/gfortran.texi +++ b/gcc/fortran/gfortran.texi @@ -1848,39 +1848,23 @@ Besides decimal constants, Fortran also supports binary (@code{b}), octal (@code{o}) and hexadecimal (@code{z}) integer constants. The syntax is: @samp{prefix quote digits quote}, were the prefix is either @code{b}, @code{o} or @code{z}, quote is either @code{'} or -@code{"} and the digits are for binary @code{0} or @code{1}, for -octal between @code{0} and @code{7}, and for hexadecimal between -@code{0} and @code{F}. (Example: @code{b'01011101'}.) - -Up to Fortran 95, BOZ literals were only allowed to initialize -integer variables in DATA statements. Since Fortran 2003 BOZ literals -are also allowed as argument of @code{REAL}, @code{DBLE}, @code{INT} -and @code{CMPLX}; the result is the same as if the integer BOZ -literal had been converted by @code{TRANSFER} to, respectively, -@code{real}, @code{double precision}, @code{integer} or @code{complex}. -As GNU Fortran extension the intrinsic procedures @code{FLOAT}, -@code{DFLOAT}, @code{COMPLEX} and @code{DCMPLX} are treated alike. - -As an extension, GNU Fortran allows hexadecimal BOZ literal constants to -be specified using the @code{X} prefix, in addition to the standard -@code{Z} prefix. The BOZ literal can also be specified by adding a -suffix to the string, for example, @code{Z'ABC'} and @code{'ABC'Z} are -equivalent. - -Furthermore, GNU Fortran allows using BOZ literal constants outside -DATA statements and the four intrinsic functions allowed by Fortran 2003. -In DATA statements, in direct assignments, where the right-hand side -only contains a BOZ literal constant, and for old-style initializers of -the form @code{integer i /o'0173'/}, the constant is transferred -as if @code{TRANSFER} had been used; for @code{COMPLEX} numbers, only -the real part is initialized unless @code{CMPLX} is used. In all other -cases, the BOZ literal constant is converted to an @code{INTEGER} value with -the largest decimal representation. This value is then converted -numerically to the type and kind of the variable in question. -(For instance, @code{real :: r = b'0000001' + 1} initializes @code{r} -with @code{2.0}.) As different compilers implement the extension -differently, one should be careful when doing bitwise initialization -of non-integer variables. +@code{"} and the digits are @code{0} or @code{1} for binary, +between @code{0} and @code{7} for octal, and between @code{0} and +@code{F} for hexadecimal. (Example: @code{b'01011101'}.) + +Up to Fortran 95, BOZ literal constants were only allowed to initialize +integer variables in DATA statements. Since Fortran 2003 BOZ literal +constants are also allowed as actual arguments to the @code{REAL}, +@code{DBLE}, @code{INT} and @code{CMPLX} intrinsic functions. +The BOZ literal constant is simply a string of bits, which is padded +or truncated as needed, during conversion to a numeric type. The +Fortran standard states that the treatment of the sign bit is processor +dependent. Gfortran interprets the sign bit as a user would expect. + +As a deprecated extension, GNU Fortran allows hexadecimal BOZ literal +constants to be specified using the @code{X} prefix. The BOZ literal +constant can also be specified by adding a suffix to the string, for +example, @code{Z'ABC'} and @code{'ABC'X} are equivalent. @node Real array indices @subsection Real array indices diff --git a/gcc/fortran/invoke.texi b/gcc/fortran/invoke.texi index 6521e25efe0..ed8cefb0979 100644 --- a/gcc/fortran/invoke.texi +++ b/gcc/fortran/invoke.texi @@ -241,10 +241,10 @@ warning. This option is implied by @option{-std=legacy}. @item -fallow-invalid-boz @opindex @code{allow-invalid-boz} -A BOZ literal constant can occur in a limited number of context in +A BOZ literal constant can occur in a limited number of contexts in standard conforming Fortran. This option degrades an error condition to a warning, and allows a BOZ literal constant to appear where the -Fortran standard would otherwise prohibits it. +Fortran standard would otherwise prohibit its use. @item -fd-lines-as-code @itemx -fd-lines-as-comments -- 2.30.2