Next: , Previous: Alternate Returns, Up: Debugging and Interfacing



13.12 Assigned Statement Labels (ASSIGN and GOTO)

For portability to machines where a pointer (such as to a label, which is how g77 implements ASSIGN and its relatives, the assigned-GOTO and assigned-FORMAT-I/O statements) is wider (bitwise) than an INTEGER(KIND=1), g77 uses a different memory location to hold the ASSIGNed value of a variable than it does the numerical value in that variable, unless the variable is wide enough (can hold enough bits).

In particular, while g77 implements

     I = 10

as, in C notation, i = 10;, it implements

     ASSIGN 10 TO I

as, in GNU's extended C notation (for the label syntax), __g77_ASSIGN_I = &&L10; (where L10 is just a massaging of the Fortran label 10 to make the syntax C-like; g77 doesn't actually generate the name L10 or any other name like that, since debuggers cannot access labels anyway).

While this currently means that an ASSIGN statement does not overwrite the numeric contents of its target variable, do not write any code depending on this feature. g77 has already changed this implementation across versions and might do so in the future. This information is provided only to make debugging Fortran programs compiled with the current version of g77 somewhat easier. If there's no debugger-visible variable named __g77_ASSIGN_I in a program unit that does ASSIGN 10 TO I, that probably means g77 has decided it can store the pointer to the label directly into I itself.

See Ugly Assigned Labels, for information on a command-line option to force g77 to use the same storage for both normal and assigned-label uses of a variable.