This is the mail archive of the
dwarf2@corp.sgi.com
mailing list for the dwarf2 project.
Re: Fortran Common Blocks
- To: Michael Eager <eager at eagercon dot com>
- Subject: Re: Fortran Common Blocks
- From: James Cownie <jcownie at etnus dot com>
- Date: Thu, 13 Apr 2000 16:52:57 +0100
- cc: "Knott, Martin" <martin at epc dot co dot uk>, "'dwarf2 at corp dot sgi dot com'" <dwarf2 at corp dot sgi dot com>
- Reply-To: James Cownie <jcownie at etnus dot com>
> 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