https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71906
Bug ID: 71906
Summary: Fortran allocatable strings debug info type size
regression
Product: gcc
Version: 6.1.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: debug
Assignee: unassigned at gcc dot gnu.org
Reporter: jan.kratochvil at redhat dot com
Target Milestone: ---
Description of problem:
Some GDB testcases started to failing gcc-5.3.1 -> gcc-6.1.1.
Version-Release number of selected component (if applicable):
PASS: gcc-5.3.1-2.fc23.x86_64
FAIL: gcc-6.1.1-3.fc24.x86_64
FAIL: 7.0.0 20160716 (experimental)
How reproducible:
Always.
Steps to Reproduce:
cat >stringalloc.f90 <<EOH
program stringalloc
character(len=:), target, allocatable :: var_char
allocate(character(len=10) :: var_char)
var_char = 'foo'
end program stringalloc
EOH
gfortran -o stringalloc stringalloc.f90 -Wall -g;gdb ./stringalloc -batch -ex
'b 5' -ex r -ex 'ptype var_char'
Actual results:
type = PTR TO -> ( character*1 )
<2><a4>: Abbrev Number: 8 (DW_TAG_variable)
<a5> DW_AT_name : (indirect string, offset: 0x111): var_char
<a9> DW_AT_decl_file : 1
<aa> DW_AT_decl_line : 2
<ab> DW_AT_type : <0xd1>
<af> DW_AT_location : 2 byte block: 91 68 (DW_OP_fbreg: -24)
<1><d0>: Abbrev Number: 11 (DW_TAG_string_type)
<1><d1>: Abbrev Number: 6 (DW_TAG_pointer_type)
<d2> DW_AT_byte_size : 8
<d3> DW_AT_type : <0xd0>
Expected results:
type = PTR TO -> ( character*10 )
<2><4c>: Abbrev Number: 3 (DW_TAG_variable)
<4d> DW_AT_name : (indirect string, offset: 0x111): var_char
<51> DW_AT_decl_file : 1
<52> DW_AT_decl_line : 2
<53> DW_AT_type : <0x7d>
<57> DW_AT_location : 2 byte block: 91 68 (DW_OP_fbreg: -24)
<1><78>: Abbrev Number: 6 (DW_TAG_string_type)
<79> DW_AT_string_length: 2 byte block: 91 64 (DW_OP_fbreg: -28)
<7c> DW_AT_byte_size : 4
<1><7d>: Abbrev Number: 7 (DW_TAG_pointer_type)
<7e> DW_AT_byte_size : 8
<7f> DW_AT_type : <0x78>
Additional info:
There is also some additional unknown DIE but that does not seem to be related:
<2><5a>: Abbrev Number: 4 (DW_TAG_variable)
<5b> DW_AT_name : (indirect string, offset: 0x110): .var_char
<5f> DW_AT_type : <0x83>
<63> DW_AT_artificial : 1
<63> DW_AT_location : 2 byte block: 91 64 (DW_OP_fbreg: -28)
<1><83>: Abbrev Number: 8 (DW_TAG_base_type)
<84> DW_AT_byte_size : 4
<85> DW_AT_encoding : 5 (signed)
<86> DW_AT_name : (indirect string, offset: 0xeb): integer(kind=4)
GDB above is Fedora gdb-7.11.1-75.fc24.x86_64, upstream GDB is not usable.
But readelf -wi is enough for analysis of this problem.