https://gcc.gnu.org/bugzilla/show_bug.cgi?id=101826
--- Comment #3 from Abdul Basit Ijaz <abdul.b.ijaz at intel dot com> ---
Using gfortran 14.1.0 result in debug info similar to @rguenth comment. This
debug information still result in <incomplete type> in gdb. Can someone please
confirm about missing DWARF here as this is causing the incomplete type. If
issue will be fixed in GFortran ?.
0x0000011f: DW_TAG_structure_type
DW_AT_declaration (true)
GFortran document for the argument passing convention of CHAR TYPE arrays also
does not mention about the structure type. In the provided reproducer char type
array has only issue in the subroutine and works fine in the main. So some
details are missing in passing "Char type" as the arguments.
https://gcc.gnu.org/onlinedocs/gfortran/Argument-passing-conventions.html
"arr" character type array in main:
0x000000ae: DW_TAG_variable
DW_AT_name ("arr")
DW_AT_decl_file ("test.f90")
DW_AT_decl_line (13)
DW_AT_decl_column (0x1f)
DW_AT_type (0x000000bf "string []")
DW_AT_location (DW_OP_fbreg -80)
0x000000bf: DW_TAG_array_type
DW_AT_type (0x000000cf "string ")
DW_AT_sibling (0x000000cf)
0x000000c8: DW_TAG_subrange_type
DW_AT_type (0x0000002f "integer(kind=8)")
DW_AT_upper_bound (5)
0x000000cf: DW_TAG_string_type
DW_AT_byte_size (0x0a)
"arr1" char type array as a subroutine argument:
0x000000f3: DW_TAG_formal_parameter
DW_AT_name ("arr1")
DW_AT_type (0x0000011f "structure ")
DW_AT_artificial (true)
DW_AT_location (DW_OP_fbreg -648, DW_OP_deref)
0x0000011f: DW_TAG_structure_type
DW_AT_declaration (true)
0x00000120: DW_TAG_array_type
DW_AT_type (0x00000133 "string ")
DW_AT_sibling (0x00000133)
0x00000129: DW_TAG_subrange_type
DW_AT_type (0x0000002f "integer(kind=8)")
DW_AT_upper_bound (0x0000010e)
GDB Output:
Breakpoint 2, MAIN__ () at test.f90:17
17 call str_arr (arr)
(gdb) pt arr
type = character*10 (5)
(gdb) p arr
$1 = ('fortranarr', 'fortranarr', 'fortranarr', 'fortranarr', 'fortranarr')
(gdb) c
Continuing.
Breakpoint 1, str_arr (arr1=<incomplete type>, _arr1=10) at test.f90:4
4 print *, arr1
(gdb) pt arr1
type = Type
End Type
(gdb) p arr1
$2 = <incomplete type>
(gdb) info address arr1
Symbol "arr1" is a complex DWARF expression:
0: DW_OP_fbreg -648
3: DW_OP_deref