RESTRICTIONS ON THE SYNTAX OF FORTRAN
 *************************************
 There are some non-obvious restrictions on the syntax of FORTRAN 77 
 in the standard specification:


  8.2.5 Restrictions on EQUIVALENCE Statements.
  
   An EQUIVALENCE statement must not specify that the same storage unit
   is to occur more than once in a storage sequence. For example,
    1. DIMENSION A(2)
    2. EQUIVALENCE (A(1),B), (A(2),B)
       
   is prohibited, because it would specify the same storage unit for A(1)
   and A(2). An EQUIVALENCE statement must not specify that consecutive
   storage units are to be nonconsecutive. For example, the following is
   prohibited:
    1. REAL A(2)
    2. DOUBLE PRECISION D(2)
    3. EQUIVALENCE (A(1),D(1)), (A(2),D(2))

  8.3.6 Restrictions on Common and Equivalence.
  
   An EQUIVALENCE statement must not cause the storage sequences of two
   different common blocks in the same program unit to be associated.
   Equivalence association must not cause a common block storage sequence
   to be extended by adding storage units preceding the first storage
   unit of the first entity specified in a COMMON statement for the
   common block. For example, the following is not permitted:
    1. COMMON /X/A
    2. REAL B(2)
    3. EQUIVALENCE (A,B(2))


9.2 DATA Statement Restrictions

   Names of dummy arguments, functions, and entities in blank common
   (including entities associated with an entity in blank common) must
   not appear in the list nlist . Names of entities in a named common
   block may appear in the list nlist only within a block data
   subprogram.
   
   There must be the same number of items specified by each list nlist
   and its corresponding list clist . There is a one-to-one
   correspondence between the items specified by nlist and the constants
   specified by clist such that the first item of nlist corresponds to
   the first constant of clist , etc. By this correspondence, the initial
   value is established and the entity is initially defined. If an array
   name without a subscript is in the list, there must be one constant
   for each element of that array. The ordering of array elements is
   determined by the array element subscript value ( 5.2.4).
   
   The type of the nlist entity and the type of the corresponding clist
   constant must agree when either is of type character or logical. When
   the nlist entity is of type integer, real, double precision, or
   complex, the 1corresponding clist constant must also be of type
   integer, real, double precision, or complex; if necessary, the clist
   constant is converted to the type of the nlist entity according to the
   rules for arithmetic conversion (Table 4). Note that if an nlist
   entity is of type double precision and the clist constant is of type
   real, the processor may supply more precision derived from the
   constant than can be contained in a real datum.
   
   Any variable, array element, or substring may be initially defined
   except for:
    1. an entity that is a dummy argument,
    2. an entity in blank common, which includes an entity associated
       with an entity in blank common, or
    3. a variable in a function subprogram whose name is also the name of
       the function subprogram or an entry in the function subprogram.
       
   A variable, array element, or substring must not be initially defined
   more than once in an executable program. If two entities are
   associated, only one may be initially defined in a DATA statement in
   the same executable program.
   
   Each subscript expression in the list nlist must be an integer
   constant expression except for implied-DO-variables as noted in 9.3.
   Each substring expression in the list nlist must be an integer
   constant expression.
   
    12.2.5.2 Internal File Restrictions.
    
   An internal file has the following restrictions:
    1. Reading and writing records is accomplished only by sequential
       access formatted input/output statements ( 12.8.1) that do not
       specify list-directed formatting.
    2. An auxiliary input/output statement must not specify an internal
       file.

12.11 Restrictions on Function References and List Items

   A function must not be referenced within an expression appearing
   anywhere in an input/output statement if such a reference causes an
   input/output statement to be executed. Note that a restriction in the
   evaluation of expressions ( 6.6) prohibits certain side effects.
   
12.12 Restriction on Input/Output Statements

   If a unit, or a file connected to a unit, does not have all of the
   properties required for the execution of certain input/output
   statements, those statements must not refer to the unit.
   

14.2 Main Program Restrictions

   The PROGRAM statement may appear only as the first statement of a main
   program. A main program may contain any other statement except a BLOCK
   DATA, FUNCTION, SUBROUTINE, ENTRY, or RETURN statement. The appearance
   of a SAVE statement in a main program has no effect.
   
   A main program may not be referenced from a subprogram or from itself.
   
   'bp '

  15.3.3 Intrinsic Function Restrictions.
  
   Arguments for which the result is not mathematically defined or
   exceeds the numeric range of the processor cause the result of the
   function to become undefined.
   
   Restrictions on the range of arguments and results for intrinsic
   functions are described in 15.10.1.

  15.4.3 Statement Function Restrictions.
  
   A statement function may be referenced only in the program unit that
   contains the statement function statement.
   
   A statement function statement must not contain a reference to another
   statement function that appears following the reference in the
   sequence of lines in the program unit. The symbolic name used to
   identify a statement function must not appear as a symbolic name in
   any specification statement except in a type-statement (to specify the
   type of the function) or as the name of a common block in the same
   program unit.
   
   An external function reference in the expression of a statement
   function statement must not cause a dummy argument of the statement
   function to become undefined or redefined.
   
   The symbolic name of a statement function is a local name ( 18.1.2)
   and must not be the same as the name of any other entity in the
   program unit except the name of a common block.
   
   The symbolic name of a statement function may not be an actual
   argument. It must not appear in an EXTERNAL statement.
   
   A statement function statement in a function subprogram must not
   contain a function reference to the name of the function subprogram or
   an entry name in the function subprogram.
   
   The length specification of a character statement function or
   statement function dummy argument of type character must be an integer
   constant expression.

  15.5.3 Function Subprogram Restrictions.
  
   A FUNCTION statement must appear only as the first statement of a
   function subprogram. A function subprogram may contain any other
   statement except a BLOCK DATA, SUBROUTINE, or PROGRAM statement.
   
   The symbolic name of an external function is a global name ( 18.1.1)
   and must not be the same as any other global name or any local name,
   except a variable name, in the function subprogram.
   
   Within a function subprogram, the symbolic name of a function
   specified by a FUNCTION or ENTRY statement must not appear in any
   other nonexecutable statement, except a type-statement. In an
   executable statement, such a name may appear only as a variable.
   
   If the type of a function is specified in a FUNCTION statement, the
   function name must not appear in a type-statement. Note that a name
   must not have its type explicitly specified more than once in a
   program unit.
   
   If the name of a function subprogram is of type character, each entry
   name in the function subprogram must be of type character. If the name
   of the function subprogram or any entry in the subprogram has a length
   of (*) declared, all such entities must have a length of (*) declared;
   otherwise, all such entities must have a length specification of the
   same integer value.
   
   In a function subprogram, the symbolic name of a dummy argument is
   local to the program unit and must not appear in an EQUIVALENCE,
   PARAMETER, SAVE, INTRINSIC, DATA, or COMMON statement, except as a
   common block name.
   
   A character dummy argument whose length specification is an asterisk
   in parentheses must not appear as an operand for concatenation, except
   in a character assignment statement ( 10.4).
   
   A function specified in a subprogram may be referenced within any
   other procedure subprogram or the main program of the executable
   program. A function subprogram must not reference itself, either
   directly or indirectly.

  15.6.3 Subroutine Subprogram Restrictions.
  
   A SUBROUTINE statement must appear only as the first statement of a
   subroutine subprogram. A subroutine subprogram may contain any other
   statement except a BLOCK DATA, FUNCTION, or PROGRAM statement.
   
   The symbolic name of a subroutine is a global name ( 18.1.1) and must
   not be the same as any other global name or any local name in the
   program unit.
   
   In a subroutine subprogram, the symbolic name of a dummy argument is
   local to the program unit and must not appear in an EQUIVALENCE,
   PARAMETER, SAVE, INTRINSIC, DATA, or COMMON statement, except as a
   common block name.
   
   A character dummy argument whose length specification is an asterisk
   in parentheses must not appear as an operand for concatenation, except
   in a character assignment statement ( 10.4).

  15.7.4 ENTRY Statement Restrictions.
  
   Within a subprogram, an entry name must not appear both as an entry
   name in an ENTRY statement and as a dummy argument in a FUNCTION,
   SUBROUTINE, or ENTRY statement and must not appear in an EXTERNAL
   statement.
   
   In a function subprogram, a variable name that is the same as an entry
   name must not appear in any statement that precedes the appearance of
   the entry name in an ENTRY statement, except in a type-statement.
   
   If an entry name in a function subprogram is of type character, each
   entry name and the name of the function subprogram must be of type
   character. If the name of the function subprogram or any entry in the
   subprogram has a length of (*) declared, all such entities must have a
   length of (*) declared; otherwise, all such entities must have a
   length specification of the same integer value.
   
   In a subprogram, a name that appears as a dummy argument in an ENTRY
   statement must not appear in an executable statement preceding that
   ENTRY statement unless it also appears in a FUNCTION, SUBROUTINE, or
   ENTRY statement that precedes the executable statement.
   
   In a subprogram, a name that appears as a dummy argument in an ENTRY
   statement must not appear in the expression of a statement function
   statement unless the name is also a dummy argument of the statement
   function, appears in a FUNCTION or SUBROUTINE statement, or appears in
   an ENTRY statement that precedes the statement function statement.
   
   If a dummy argument appears in an executable statement, the execution
   of the executable statement is permitted during the execution of a
   reference to the function or subroutine only if the dummy argument
   appears in the dummy argument list of the procedure name referenced.
   Note that the association of dummy arguments with actual arguments is
   not retained between references to a function or subroutine.

    15.9.3.6 Restrictions on Association of Entities.
    
   If a subprogram reference causes a dummy argument in the referenced
   subprogram to become associated with another dummy argument in the
   referenced subprogram, neither dummy argument may become defined
   during execution of that subprogram. For example, if a subroutine is
   headed by

SUBROUTINE XYZ (A,B)

   and is referenced by
CALL XYZ (C,C)

   the[n the dummy arguments A and B each become associated with the same
   actual argument C and therefore with each other. Neither A nor B may
   become defined during this execution of subroutine XYZ or by any
   procedures referenced by XYZ.
   
   If a subprogram reference causes a dummy argument to become associated
   with an entity in a common block in the referenced subprogram or in a
   subprogram referenced by the referenced subprogram, neither the dummy
   argument nor the entity in the common block may become defined within
   the subprogram or within a subprogram referenced by the referenced
   subprogram. For example, if a subroutine contains the statements:
    1. SUBROUTINE XYZ (A)
    2. COMMON C
       
   and is referenced by a program unit that contains the statements:
    1. COMMON B
    2. CALL XYZ (B)
       
   then the dummy argument A becomes associated with the actual argument
   B, which is associated with C, which is in a common block. Neither A
   nor C may become defined during execution of the subroutine XYZ or by
   any procedures referenced by XYZ.

  15.10.1 Restrictions on Range of Arguments and Results.
  
   Restrictions on the range of arguments and results for intrinsic
   functions when referenced by their specific names are as follows:
    1. Remaindering: The result for MOD, AMOD, and DMOD is undefined when
       the value of the second argument is zero.
    2. Transfer of Sign: If the value of the first argument of ISIGN,
       SIGN, or DSIGN is zero, the result is zero, which is neither
       positive or negative ( 4.1.3).
    3. Square Root: The value of the argument of SQRT and DSQRT must be
       greater than or equal to zero. The result of CSQRT is the
       principal value with the real part greater than or equal to zero.
       When the real part of the result is zero, the imaginary part is
       greater than or equal to zero.
    4. Logarithms: The value of the argument of ALOG, DLOG, ALOG10, and
       DLOG10 must be greater than zero. The value of the argument of
       CLOG must not be (0.,0.). The range of the imaginary part of the
       result of CLOG is: -pi < imaginary part <= pi . The imaginary part
       of the result is pi only when the real part of the argument is
       less than zero and the imaginary part of the argument is zero.
    5. Sine, Cosine, and Tangent: The absolute value of the argument of
       SIN, DSIN, COS, DCOS, TAN, and DTAN is not restricted to be less
       than 2pi .
    6. Arcsine: The absolute value of the argument of ASIN and DASIN must
       be less than or equal to one. The range of the result is: -pi/2 <=
       result <= pi/2 .
    7. Arccosine: The absolute value of the argument of ACOS and DACOS
       must be less than or equal to one. The range of the result is: 0
       <= result <=pi .
    8. Arctangent: The range of the result for ATAN and DATAN is: -pi/2
       <= result <= pi/2 . If the value of the first argument of ATAN2 or
       DATAN2 is positive, the result is positive. If the value of the
       first argument is zero, the result is zero if the second argument
       is positive and pi if the second argument is negative. If the
       value of the first argument is negative, the result is negative.
       If the value of the second argument is zero, the absolute value of
       the result is pi/2 . The arguments must not both have the value
       zero. The range of the result for ATAN2 and DATAN2 is: -pi <
       result <= pi .
       
   The above restrictions on arguments and results also apply to the
   intrinsic functions when referenced by their generic names.
   
   

16.2 Block Data Subprogram Restrictions

   The BLOCK DATA statement must appear only as the first statement of a
   block data subprogram. The only other statements that may appear in a
   block data subprogram are IMPLICIT, PARAMETER, DIMENSION, COMMON,
   SAVE, EQUIVALENCE, DATA, END, and type-statements. Note that comment
   lines are permitted.
   
   If an entity in a named common block is initially defined, all
   entities having storage units in the common block storage sequence
   must be specified even if they are not all initially defined. More
   than one named common block may have entities initially defined in a
   single block data subprogram.
   
   Only an entity in a named common block may be initially defined in a
   block data subprogram. Note that entities associated with an entity in
   a common block are considered to be in that common block.
   
   The same named common block may not be specified in more than one
   block data subprogram in the same executable program.
   
   There must not be more than one unnamed block data subprogram in an
   executable program.