Go to the first, previous, next, last section, table of contents.


Common Blocks (COMMON)

g77 names and lays out COMMON areas the same way f2c does, for compatibility with f2c.

Currently, g77 does not emit "true" debugging information for members of a COMMON area, due to an apparent bug in the GBE.

(As of Version 0.5.19, g77 emits debugging information for such members in the form of a constant string specifying the base name of the aggregate area and the offset of the member in bytes from the start of the area. Use the `-fdebug-kludge' option to enable this behavior. In gdb, use `set language c' before printing the value of the member, then `set language fortran' to restore the default language, since gdb doesn't provide a way to print a readable version of a character string in Fortran language mode.

This kludge will be removed in a future version of g77 that, in conjunction with a contemporary version of gdb, properly supports Fortran-language debugging, including access to members of COMMON areas.)

See section Options for Code Generation Conventions, for information on the `-fdebug-kludge' option.

Moreover, g77 currently implements a COMMON area such that its type is an array of the C char data type.

So, when debugging, you must know the offset into a COMMON area for a particular item in that area, and you have to take into account the appropriate multiplier for the respective sizes of the types (as declared in your code) for the items preceding the item in question as compared to the size of the char type.

For example, using default implicit typing, the statement

COMMON I(15), R(20), T

results in a public 144-byte char array named `_BLNK__' with `I' placed at `_BLNK__[0]', `R' at `_BLNK__[60]', and `T' at `_BLNK__[140]'. (This is assuming that the target machine for the compilation has 4-byte INTEGER(KIND=1) and REAL(KIND=1) types.)


Go to the first, previous, next, last section, table of contents.