This is the mail archive of the dwarf2@corp.sgi.com mailing list for the dwarf2 project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: Fortran Common Blocks




> 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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]