GNU Fortran (GCC) 4.5.0 20091003 (experimental) subroutine f(s) character*3 s s = s end call f ('foo') end
gdb -nx -ex 'b 3' -ex r -ex 'p s' ./file -> Cannot access memory at address 0x6f6f66 <2><4a>: Abbrev Number: 3 (DW_TAG_formal_parameter) <4b> DW_AT_name : s <4f> DW_AT_type : <0x64> <53> DW_AT_location : 4 byte block: 75 0 6 6 (DW_OP_breg5: 0; DW_OP_deref; DW_OP_deref) If I patch those two DW_OP_deref -> DW_OP_nop then GDB prints: $1 = 'foo' gfortran -o 1 1.f90 -Wall -g -O1 currently: .LC0: .ascii "foo" ... movl $.LC0, %edi ... .byte 0x4 # DW_AT_location .byte 0x75 # DW_OP_breg5 .sleb128 0 .byte 0x6 # DW_OP_deref .byte 0x6 # DW_OP_deref -- Summary: gfortran -O code excessive DW_OP_deref's Product: gcc Version: 4.5.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: debug AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: jan dot kratochvil at redhat dot com GCC target triplet: x86_64-unknown-linux-gnu http://gcc.gnu.org/bugzilla/show_bug.cgi?id=41558