[Bug fortran/101826] GFORTRAN: Debug info missing DW_TAG_string_type for array of variable length string

rguenth at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Mon Aug 9 13:00:20 GMT 2021


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101826

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Last reconfirmed|                            |2021-08-09
             Status|UNCONFIRMED                 |NEW
     Ever confirmed|0                           |1

--- Comment #1 from Richard Biener <rguenth at gcc dot gnu.org> ---
Confirmed on trunk.  The DW_TAG_structure_type contains the DW_AT_string_type:

 <1><126>: Abbrev Number: 17 (DW_TAG_structure_type)
    <127>   DW_AT_declaration : 1
 <1><127>: Abbrev Number: 6 (DW_TAG_array_type)
    <128>   DW_AT_type        : <0x13a>
    <12c>   DW_AT_sibling     : <0x13a>
 <2><130>: Abbrev Number: 18 (DW_TAG_subrange_type)
    <131>   DW_AT_type        : <0x2f>
    <135>   DW_AT_upper_bound : <0x115>
 <2><139>: Abbrev Number: 0
 <1><13a>: Abbrev Number: 19 (DW_TAG_string_type)
    <13b>   DW_AT_string_length: <0x108>

so appearantly we leak some implementation detail into the DWARF?

When debugging with gdb I see

(gdb) s
str_arr (arr1=<incomplete type>, _arr1=10) at t.f90:1
1       subroutine str_arr (arr1)
(gdb) ptype arr1
type = Type 
End Type 

and the function looks like

void str_arr (struct array01_character(kind=1) & restrict arr1, integer(kind=8)
_arr1)

thus the parametrized string is passed as a reference to a structure plus
a separate length argument.

  character(kind=1)[0:D.3976][1:_arr1] * restrict arr1.0;
...
  arr1.0_23 = arr1_18(D)->data;


More information about the Gcc-bugs mailing list