http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59438
Bug ID: 59438
Summary: DWARF: Fortran mishandles ALLOCATABLE/ASSOCIATED in
debug output
Product: gcc
Version: 4.9.0
Status: UNCONFIRMED
Keywords: wrong-code
Severity: normal
Priority: P3
Component: fortran
Assignee: unassigned at gcc dot gnu.org
Reporter: burnus at gcc dot gnu.org
Reported by Sanimir of Intel, who is working on GDB VLA/Fortran array support.
(See various patches at gdb-patches@ or http://intel-gdb.github.io/)
(a) The DW_AT_allocated/DW_AT_associated is lacking for scalars - including
strings.
For arrays, it is handled via "struct array_descr_info", which is filled via
gfc_get_array_descr_info, via info->allocated and info->associated.
(b) Dynamic strings are wrapped within a DW_TAG_pointer_type
character(len=:), allocatable :: str
Printing 'str' yields (PTR TO -> ( character*N )) 0xdeadbeef. Unfortunately
gfortran emits a DW_TAG_pointer_type for dynamic strings, which is not the case
for allocatable arrays.
--> Drop pointer_type and add an allocatable predicate so gdb can dereference
the string if it is allowed to.
(c) Allocatable/associated bits are available after stepping over variable
declaration.
integer, allocatable :: array(:) ! attribute is missing
The above predicates will be initialized _after_ the inferior has passed the
line and thus gdb shows some random state before the line is executed.
--> Hoist the initialization of these bits (assign .False.) into the prologue,
this allows gdb to determine the correct status of the variable at any given
time.