The -fugly-assign
option forces g77
to use the
same storage for assigned labels as it would for a normal
assignment to the same variable.
For example, consider the following code fragment:
I = 3 ASSIGN 10 TO I
Normally, for portability and improved diagnostics, g77
reserves distinct storage for a "sibling" of I
, used
only for ASSIGN
statements to that variable (along with
the corresponding assigned-GOTO
and assigned-FORMAT
-I/O
statements that reference the variable).
However, some code (that violates the ANSI FORTRAN 77 standard)
attempts to copy assigned labels among variables involved with
ASSIGN
statements, as in:
ASSIGN 10 TO I ISTATE(5) = I ... J = ISTATE(ICUR) GOTO J
Such code doesn't work under g77
unless -fugly-assign
is specified on the command-line, ensuring that the value of I
referenced in the second line is whatever value g77
uses
to designate statement label 10
, so the value may be
copied into the ISTATE
array, later retrieved into a
variable of the appropriate type (J
), and used as the target of
an assigned-GOTO
statement.
Note: To avoid subtle program bugs,
when -fugly-assign
is specified,
g77
requires the type of variables
specified in assigned-label contexts
must be the same type returned by %LOC()
.
On many systems, this type is effectively the same
as INTEGER(KIND=1)
, while, on others, it is
effectively the same as INTEGER(KIND=2)
.
Do not depend on g77
actually writing valid pointers
to these variables, however.
While g77
currently chooses that implementation, it might
be changed in the future.
See Assigned Statement Labels (ASSIGN and GOTO), for implementation details on assigned-statement labels.