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
Created attachment 18706 [details] gcc45-pr41558.patch Patch I'm going to bootstrap/regtest. BTW, gdb 7.0.50.20091005-cvs doesn't work with the guality.exp testcases well, something broke in it recently. 6.8.91.20090917-1.fc12 works fine.
Subject: Bug 41558 Author: jakub Date: Mon Oct 5 19:50:57 2009 New Revision: 152467 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=152467 Log: PR debug/41558 * dwarf2out.c (loc_by_reference): Removed. (dw_loc_list_1): New function. (dw_loc_list): Remove toplev argument, add want_address argument. Don't look at decl_by_reference_p at all. Use dw_loc_list_1. (loc_list_from_tree) <case VAR_DECL>: Pass want_address rather than want_address == 2 to dw_loc_list. For successful dw_loc_list set have_address to 1 only if want_address is not 0. * gcc.dg/guality/guality.exp: Move gdb-test proc into... * lib/gcc-gdb-test.exp: ... here. New file. * gfortran.dg/guality/guality.exp: New file. * gfortran.dg/guality/pr41558.f90: New test. * gfortran.dg/guality/arg1.f90: New test. Added: trunk/gcc/testsuite/gfortran.dg/guality/ trunk/gcc/testsuite/gfortran.dg/guality/arg1.f90 trunk/gcc/testsuite/gfortran.dg/guality/guality.exp trunk/gcc/testsuite/gfortran.dg/guality/pr41558.f90 trunk/gcc/testsuite/lib/gcc-gdb-test.exp Modified: trunk/gcc/ChangeLog trunk/gcc/dwarf2out.c trunk/gcc/testsuite/ChangeLog trunk/gcc/testsuite/gcc.dg/guality/guality.exp
(In reply to comment #1) > BTW, gdb 7.0.50.20091005-cvs doesn't work with the guality.exp testcases well, > something broke in it recently. 6.8.91.20090917-1.fc12 works fine. There is an array with variable size: integer :: a(n), n VLA support is still missing in FSF GDB, it is present in Archer (+Fedora) branch archer-jankratochvil-vla: http://sourceware.org/gdb/wiki/ArcherBranchManagement
Fixed.