Hollerith constant documentation

Message ID 7f6ccb7d-7576-c8ca-586e-86845e785be8@codethink.co.uk
State New
Headers show
Series
  • Hollerith constant documentation
Related show

Commit Message

Mark Eggleston May 13, 2019, 2:57 p.m.
The Hollerith constants support section in the gfortran manual stated 
that they can be used with the ASSIGN statement. This is not the case as 
a compilation error occurs and in any event the value of any such 
constant would be larger than the largest valid label (99999).

I've added some extra examples along with other minor changes.

I do not have commit privileges so someone else will have to commit this:

For the change log:

     Mark Eggleston  <mark.eggleston@codethink.com>

     * gfortran.texi: Remove reference to the ASSIGN statement, capitalise
     complex, state that padding is with spaces and modify the Hollerith
     constant examples.

-- 
https://www.codethink.co.uk/privacy.html

Comments

Jeff Law May 20, 2019, 9:49 p.m. | #1
On 5/13/19 8:57 AM, Mark Eggleston wrote:
> The Hollerith constants support section in the gfortran manual stated

> that they can be used with the ASSIGN statement. This is not the case as

> a compilation error occurs and in any event the value of any such

> constant would be larger than the largest valid label (99999).

> 

> I've added some extra examples along with other minor changes.

> 

> I do not have commit privileges so someone else will have to commit this:

> 

> For the change log:

> 

>     Mark Eggleston  <mark.eggleston@codethink.com>

> 

>     * gfortran.texi: Remove reference to the ASSIGN statement, capitalise

>     complex, state that padding is with spaces and modify the Hollerith

>     constant examples.

> 

THanks.  I've installed this on the trunk.
jeff

Patch

From 8f26259d673708241abcdb57d3f218bd7ebbeb0f Mon Sep 17 00:00:00 2001
From: Mark Eggleston <markeggleston@codethink.com>
Date: Mon, 13 May 2019 15:30:07 +0100
Subject: [PATCH] Update documentation for Hollerith Constants

---
 gcc/fortran/gfortran.texi | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/gcc/fortran/gfortran.texi b/gcc/fortran/gfortran.texi
index e2a1d7ccfab..c887e7d1a42 100644
--- a/gcc/fortran/gfortran.texi
+++ b/gcc/fortran/gfortran.texi
@@ -1923,13 +1923,13 @@  in I/O operations.
 @cindex Hollerith constants
 
 GNU Fortran supports Hollerith constants in assignments, function
-arguments, and @code{DATA} and @code{ASSIGN} statements.  A Hollerith
-constant is written as a string of characters preceded by an integer
-constant indicating the character count, and the letter @code{H} or
-@code{h}, and stored in bytewise fashion in a numeric (@code{INTEGER},
-@code{REAL}, or @code{complex}) or @code{LOGICAL} variable.  The
-constant will be padded or truncated to fit the size of the variable in
-which it is stored.
+arguments, and @code{DATA} statements.  A Hollerith constant is written
+as a string of characters preceded by an integer constant indicating the
+character count, and the letter @code{H} or @code{h}, and stored in
+bytewise fashion in a numeric (@code{INTEGER}, @code{REAL}, or
+@code{COMPLEX}) or @code{LOGICAL} variable.  The constant will be padded
+with spaces or truncated to fit the size of the variable in which it is
+stored.
 
 Examples of valid uses of Hollerith constants:
 @smallexample
@@ -1939,11 +1939,13 @@  Examples of valid uses of Hollerith constants:
       call foo (4h abc)
 @end smallexample
 
-Invalid Hollerith constants examples:
+Examples of Hollerith constants:
 @smallexample
       integer*4 a
+      a = 0H         ! Invalid, at least one character is needed.
+      a = 4HAB12     ! Valid
       a = 8H12345678 ! Valid, but the Hollerith constant will be truncated.
-      a = 0H         ! At least one character is needed.
+      a = 3Hxyz      ! Valid, but the Hollerith constant will be padded.
 @end smallexample
 
 In general, Hollerith constants were used to provide a rudimentary
-- 
2.11.0