STABS: Based Variables

Next: Parameters, Previous: Statics, Up: Variables [Contents][Index]

### 4.6 Fortran Based Variables

Fortran (at least, the Sun and SGI dialects of FORTRAN-77) has a feature which allows allocating arrays with `malloc`, but which avoids blurring the line between arrays and pointers the way that C does. In stabs such a variable uses the ‘`b`’ symbol descriptor.

For example, the Fortran declarations

    real foo, foo10(10), foo10_5(10,5)
    pointer (foop, foo)
    pointer (foo10p, foo10)
    pointer (foo105p, foo10_5)

produce the stabs

    foo:b6
    foo10:bar3;1;10;6
    foo10_5:bar3;1;5;ar3;1;10;6

In this example, `real` is type 6 and type 3 is an integral type which is the type of the subscripts of the array (probably `integer`).

The ‘`b`’ symbol descriptor is like ‘`V`’ in that it denotes a statically allocated symbol whose scope is local to a function; see See Statics. The value of the symbol, instead of being the address of the variable itself, is the address of a pointer to that variable. So in the above example, the value of the `foo` stab is the address of a pointer to a real, the value of the `foo10` stab is the address of a pointer to a 10-element array of reals, and the value of the `foo10_5` stab is the address of a pointer to a 5-element array of 10-element arrays of reals.