[Dwarf-Discuss] A proposal for solving representing fortran descriptors

Kendrick Wong kendrick@ca.ibm.com
Fri Nov 5 16:06:52 GMT 2010


Here is an example to illustrate why it is necessary for DWARF duplicate 
types to describe a single fortran type:

type :: dt (l)
  integer, len :: l
  integer :: arr(l)
end type

integer :: n = 4
contains

subroutine s()
type (dt(n))               :: t1
type (dt(n)), pointer      :: t2
type (dt(n)), allocatable  :: t3
end subroutine

end

t1, t2 and t3 all share the same type 'dt'.  All of them access the data 
thru a descriptor. The DWARF spec currently say that DW_AT_data_location 
attribute is used on the type to represent this indirection.  (The same is 
true for DW_AT_associated and DW_AT_allocated)

"The DW_AT_data_location attribute may be used with any type that provides 
one or more levels of hidden indirection and/or run-time parameters in its 
representation. Its value is a location description. The result of 
evaluating this description yields the location of the data for an object. 
When this attribute is omitted, the address of the data is the same as the 
address of the object."

 At present time, the DWARF would look like:

$1: DW_TAG_structure_type
      DW_AT_name (dt)
      DW_AT_data_location (...)    ! vanilla descriptor access
$2:   DW_TAG_member ...

$3: DW_TAG_structure_type
      DW_AT_name (dt)
      DW_AT_data_location (...)
      DW_AT_associated (...)       ! 'pointer'
$4:   DW_TAG_member ...

$5: DW_TAG_structure_type          ! 3 different types of 'dt' is 
necessary, because all 3 variables have
      DW_AT_name (dt)              ! different descriptor characteristics
      DW_AT_data_location (...)
      DW_AT_allocated (...)        ! 'allocatable'
$6:   DW_TAG_member ...

$7: DW_TAG_variable
      DW_AT_name (t1)
      DW_AT_type ($1)
      DW_AT_location (...)
$8: DW_TAG_variable
      DW_AT_name (t2)
      DW_AT_type ($3)
      DW_AT_location (...)
$9: DW_TAG_variable
      DW_AT_name (t3)
      DW_AT_type ($5)
      DW_AT_location (...)

Even though the type 'dt' is the same for all variables, the duplication 
of type information is unavoidable under the current scheme.

=====
I would like to propose a new type TAG to capture the descriptor specific 
attributes: DW_TAG_descriptor_type.  It would make modification to 5.14 
"Dynamic Type Properties":

A base or user-defined type may be accessed through a descriptor.  A 
descriptor is represented in DWARF by the debug information entry with the 
tag DW_TAG_descriptor_type.  It has a DW_AT_type attribute, whose value is 
a reference to a debugging information entry describing a base type, a 
user-defined type or a type modifier.

A descriptor type entry has DW_AT_data_location attribute....  (same as 
current descriptions)
A descriptor type entry may have DW_AT_allocated attribute .. (same as 
current descriptions)
A descriptor type entry may have DW_AT_assocated attribute .. (same as 
current descriptions)

There are other documentation modification necessary, but this gives an 
overall idea of the proposal.

Here is the new DWARF:

$11: DW_TAG_structure_type
      DW_AT_name (dt)
$12:  DW_TAG_member ...

$13: DW_TAG_descriptor_type        ! vanilla descriptor access
      DW_AT_data_location (...)
      DW_AT_type ($11)

$14: DW_TAG_descriptor_type
      DW_AT_data_location (...)
      DW_AT_associated (...)       ! 'pointer'
      DW_AT_type ($11)

$15: DW_TAG_descriptor_type
      DW_AT_data_location (...)
      DW_AT_allocated (...)        ! 'allocatable'
      DW_AT_type ($11)

$16: DW_TAG_variable
      DW_AT_name (t1)
      DW_AT_type ($13)
      DW_AT_location (...)
$17: DW_TAG_variable
      DW_AT_name (t2)
      DW_AT_type ($14)
      DW_AT_location (...)
$18: DW_TAG_variable
      DW_AT_name (t3)
      DW_AT_type ($15)
      DW_AT_location (...)

Kendrick Wong 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.dwarfstd.org/private.cgi/dwarf-discuss-dwarfstd.org/attachments/20101105/f94e68be/attachment.htm>



More information about the Dwarf-discuss mailing list