[Bug debug/78375] New: Fortran, pointer to structure, data_member_location
bernhard.heckel at intel dot com
gcc-bugzilla@gcc.gnu.org
Wed Nov 16 09:56:00 GMT 2016
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=78375
Bug ID: 78375
Summary: Fortran, pointer to structure, data_member_location
Product: gcc
Version: 6.2.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: debug
Assignee: unassigned at gcc dot gnu.org
Reporter: bernhard.heckel at intel dot com
Target Milestone: ---
Created attachment 40052
--> https://gcc.gnu.org/bugzilla/attachment.cgi?id=40052&action=edit
Pointer to struct example
According to DWARF4 & 5, DW_AT_data_member_location is referring to the
beginning of the containing entity.
If a pointer has a target type of a struct, it means the pointer has first
to be dereferenced (address of the containing entity)
before the location of the member types can be resolved.
Fortran specifies pointers but it doesn't specify a dereference operator.
Rather then explicitly using a pointer type with a structure as a target type,
I suggest to use a structure type with the DW_AT_associated attribute (Pointer
attribute)
This approach would be similar to how array pointers are implemented at the
moment.
>From my point of view, DW_AT_associated (pointer) attribute should be preferred
over all rather then using pointer types.
Advantage I see:
- Less debug overhead, just one attribute compared to an additional tag +
attributes
- Similar approach to example "D.2.4 Fortran Dynamic Type Example" in DWARF 5
- No additional explicit dereferencing needed to get target value
I added a small example for the pointer to struct use-case.
More information about the Gcc-bugs
mailing list