This is the mail archive of the
dwarf2@corp.sgi.com
mailing list for the dwarf2 project.
Re: Fortran Common Blocks
- To: James Cownie <jcownie at etnus dot com>
- Subject: Re: Fortran Common Blocks
- From: Michael Eager <eager at eagercon dot com>
- Date: Thu, 13 Apr 2000 15:09:04 -0700
- CC: "Knott, Martin" <martin at epc dot co dot uk>, "'dwarf2 at corp dot sgi dot com'" <dwarf2 at corp dot sgi dot com>
- References: <E12flvY-0002sy-00.2000-04-13-16-53-08@mail17.svr.pol.co.uk>
- Reply-To: Michael Eager <eager at eagercon dot com>
Oops. I forgot that the common name is global, but the elements are local.
James Cownie wrote:
>
> > I'm sure that there are folks with much better knowledge of Fortran than
> > I, but my first thought is that common blocks are global, not local
> > to a subroutine. This suggests to me that the DW_TAG_common_block should
> > be a sibling of DW_TAG_subprogram, not a child.
>
> AAArrrggghhhh _no_. Common blocks should be local to a subroutine.
>
> Conside legal (if ill advised) FORTRAN like this
>
> subroutine foo
> integer i
> real r
> common /madman/ i, r
> C ... etc ...
> end
>
> subroutine bah
> integer i
> real r
> common /madman/ r, i
> C ... etc ...
> end
>
> If you're going to debug this properly you'd better have two separate
> and properly scoped instances of the common block definition for
> "madman".
>
> This example is clearly nutty, but there are older f77 codes which
> do exactly this kind of thing (particularly with blank common) to
> reduce their store requirements by sharing the same space for
> temporary arrays.
>
> As to what's wrong with the dwarf, that's less clear to me.
>
> It looks OK to me, though you need a DW_TAG_common_inclusion to
> actually state that the common block is being used in a subroutine.
>
> Common blocks should certainly own variables...
>
> -- Jim
>
> James Cownie <jcownie@etnus.com>
> Etnus, Inc. +44 117 9071438
> http://www.etnus.com
--
Michael Eager Eager Consulting eager@eagercon.com
1960 Park Blvd., Palo Alto, CA 94306 650-325-8077