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

            Bug ID: 101826
           Summary: GFORTRAN: Debug info missing DW_TAG_string_type for
                    array of variable length string
           Product: gcc
           Version: 11.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
          Assignee: unassigned at gcc dot gnu.org
          Reporter: abdul.b.ijaz at intel dot com
  Target Milestone: ---

Using GFortran 11.1.0 or older versions it is seen that dwarf debug info does
not contain DW_TAG_string_type for array of variable length strings like shown
in reproducer below and instead it contains DW_TAG_structure_type. As per dwarf
spec there should have been DW_TAG_string_type for string type object.

Reproducer program:

subroutine str_arr (arr1)
  character (len=*):: arr1(:)

  print *, arr1
end subroutine str_arr

program main
interface
  subroutine str_arr (arr1)
    character (len=*):: arr1 (:)
  end subroutine str_arr
end interface
  character (len=10) :: arr (5)

  arr = 'fortranarr'

  call str_arr (arr)

end program main


Dwarf info:

 <1><de>: Abbrev Number: 14 (DW_TAG_subprogram)
    <df>   DW_AT_external    : 1
    <df>   DW_AT_name        : (indirect string, offset: 0x12): str_arr
    <e3>   DW_AT_decl_file   : 1
    <e4>   DW_AT_decl_line   : 1
    <e5>   DW_AT_decl_column : 18
    <e6>   DW_AT_linkage_name: (indirect string, offset: 0x4b): str_arr_
    <ea>   DW_AT_low_pc      : 0x7d5
    <f2>   DW_AT_high_pc     : 0x19f
    <fa>   DW_AT_frame_base  : 1 byte block: 9c         (DW_OP_call_frame_cfa)
    <fc>   DW_AT_GNU_all_tail_call_sites: 1
    <fc>   DW_AT_sibling     : <0x12c>
 <2><100>: Abbrev Number: 15 (DW_TAG_formal_parameter)
    <101>   DW_AT_name        : (indirect string, offset: 0x1): arr1
    <105>   DW_AT_type        : <0x12c>
    <109>   DW_AT_artificial  : 1
    <109>   DW_AT_location    : 4 byte block: 91 f8 7a 6        (DW_OP_fbreg:
-648; DW_OP_deref)
 <2><10e>: Abbrev Number: 15 (DW_TAG_formal_parameter)
    <10f>   DW_AT_name        : (indirect string, offset: 0x0): _arr1
    <113>   DW_AT_type        : <0x35>
    <117>   DW_AT_artificial  : 1
    <117>   DW_AT_location    : 3 byte block: 91 f0 7a  (DW_OP_fbreg: -656)
 <2><11b>: Abbrev Number: 16 (DW_TAG_variable)
    <11c>   DW_AT_type        : <0x2e>
    <120>   DW_AT_artificial  : 1
    <120>   DW_AT_location    : 2 byte block: 91 50     (DW_OP_fbreg: -48)
 <2><123>: Abbrev Number: 16 (DW_TAG_variable)
    <124>   DW_AT_type        : <0x14d>
    <128>   DW_AT_artificial  : 1
    <128>   DW_AT_location    : 2 byte block: 91 58     (DW_OP_fbreg: -40)
 <2><12b>: Abbrev Number: 0
 <1><12c>: Abbrev Number: 17 (DW_TAG_structure_type)
    <12d>   DW_AT_declaration : 1

Reply via email to