Help using f77

toon@moene.indiv.nluug.nl toon@moene.indiv.nluug.nl
Mon Nov 22 13:19:00 GMT 1999


Carmen Lucia Tancredo Borges <carmen@coep.ufrj.br> correctly pointed out
to me that the following in the g77 manual:

Ugly Conversion of Initializers
-------------------------------

   The constructs disabled by `-fno-ugly-init' are:

   * Use of Hollerith and typeless constants in contexts where they set
     initial (compile-time) values for variables, arrays, and named
     constants--that is, `DATA' and `PARAMETER' statements, plus
     type-declaration statements specifying initial values.

     Here are some sample initializations that are disabled by the
     `-fno-ugly-init' option:

          PARAMETER (VAL='9A304FFE'X)
          REAL*8 STRING/8HOUTPUT00/
          DATA VAR/4HABCD/

   * In the same contexts as above, use of character constants to
     initialize numeric items and vice versa (one constant per item).

     Here are more sample initializations that are disabled by the
     `-fno-ugly-init' option:

          INTEGER IA
          CHARACTER BELL
          PARAMETER (IA = 'A')
          PARAMETER (BELL = 7)

   * Use of Hollerith and typeless constants on the right-hand side of
     assignment statements to numeric types, and in other contexts
     (such as passing arguments in invocations of intrinsic procedures
     and statement functions) that are treated as assignments to known
     types (the dummy arguments, in these cases).

     Here are sample statements that are disabled by the
     `-fno-ugly-init' option:

          IVAR = 4HABCD
          PRINT *, IMAX0(2HAB, 2HBA)

   The above constructs, when used, can tend to result in non-portable
code.  But, they are widely used in existing Fortran code in ways that
often are quite portable.  Therefore, they are enabled by default.

- - - - - - - - - -

strongly suggests that

      REAL A
      DATA A /'    '/

would be compilable when using the (default) option -fugly-init.

Unfortunately, it draws:

test2.f: In program `aap':
test2.f:2: 
         data a /'    '/
                 ^
Type disagreement between expressions at (?) and (^)

I'd consider this a bug.

Cheers,
Toon.


More information about the Gcc-bugs mailing list