DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 

(g77.info) Pedantic Compilation

Info Catalog (g77.info) Fortran 90 (g77.info) Other Dialects (g77.info) Distensions
 
 Pedantic Compilation
 ====================
 
    The `-fpedantic' command-line option specifies that `g77' is to warn
 about code that is not standard-conforming.  This is useful for finding
 some extensions `g77' accepts that other compilers might not accept.
 (Note that the `-pedantic' and `-pedantic-errors' options always imply
 `-fpedantic'.)
 
    With `-fno-f90' in force, ANSI FORTRAN 77 is used as the standard
 for conforming code.  With `-ff90' in force, Fortran 90 is used.
 
    The constructs for which `g77' issues diagnostics when `-fpedantic'
 and `-fno-f90' are in force are:
 
    * Automatic arrays, as in
 
           SUBROUTINE X(N)
           REAL A(N)
           ...
 
      where `A' is not listed in any `ENTRY' statement, and thus is not
      a dummy argument.
 
    * The commas in `READ (5), I' and `WRITE (10), J'.
 
      These commas are disallowed by FORTRAN 77, but, while strictly
      superfluous, are syntactically elegant, especially given that
      commas are required in statements such as `READ 99, I' and `PRINT
      *, J'.  Many compilers permit the superfluous commas for this
      reason.
 
    * `DOUBLE COMPLEX', either explicitly or implicitly.
 
      An explicit use of this type is via a `DOUBLE COMPLEX' or
      `IMPLICIT DOUBLE COMPLEX' statement, for examples.
 
      An example of an implicit use is the expression `C*D', where `C'
      is `COMPLEX(KIND=1)' and `D' is `DOUBLE PRECISION'.  This
      expression is prohibited by ANSI FORTRAN 77 because the rules of
      promotion would suggest that it produce a `DOUBLE COMPLEX'
      result--a type not provided for by that standard.
 
    * Automatic conversion of numeric expressions to `INTEGER(KIND=1)'
      in contexts such as:
 
         - Array-reference indexes.
 
         - Alternate-return values.
 
         - Computed `GOTO'.
 
         - `FORMAT' run-time expressions (not yet supported).
 
         - Dimension lists in specification statements.
 
         - Numbers for I/O statements (such as `READ (UNIT=3.2), I')
 
         - Sizes of `CHARACTER' entities in specification statements.
 
         - Kind types in specification entities (a Fortran 90 feature).
 
         - Initial, terminal, and incrementation parameters for
           implied-`DO' constructs in `DATA' statements.
 
    * Automatic conversion of `LOGICAL' expressions to `INTEGER' in
      contexts such as arithmetic `IF' (where `COMPLEX' expressions are
      disallowed anyway).
 
    * Zero-size array dimensions, as in:
 
           INTEGER I(10,20,4:2)
 
    * Zero-length `CHARACTER' entities, as in:
 
           PRINT *, ''
 
    * Substring operators applied to character constants and named
      constants, as in:
 
           PRINT *, 'hello'(3:5)
 
    * Null arguments passed to statement function, as in:
 
           PRINT *, FOO(,3)
 
    * Disagreement among program units regarding whether a given `COMMON'
      area is `SAVE'd (for targets where program units in a single source
      file are "glued" together as they typically are for UNIX
      development environments).
 
    * Disagreement among program units regarding the size of a named
      `COMMON' block.
 
    * Specification statements following first `DATA' statement.
 
      (In the GNU Fortran language, `DATA I/1/' may be followed by
      `INTEGER J', but not `INTEGER I'.  The `-fpedantic' option
      disallows both of these.)
 
    * Semicolon as statement separator, as in:
 
           CALL FOO; CALL BAR
 
    * Use of `&' in column 1 of fixed-form source (to indicate
      continuation).
 
    * Use of `CHARACTER' constants to initialize numeric entities, and
      vice versa.
 
    * Expressions having two arithmetic operators in a row, such as
      `X*-Y'.
 
    If `-fpedantic' is specified along with `-ff90', the following
 constructs result in diagnostics:
 
    * Use of semicolon as a statement separator on a line that has an
      `INCLUDE' directive.
 
Info Catalog (g77.info) Fortran 90 (g77.info) Other Dialects (g77.info) Distensions
automatically generated byinfo2html