A simple example shows the problem: program test implicit none integer i character(16) abc abc = "abc" i = 7 end program Compile with: gfortran -g -O0 test.f90 Run with gdb and "whatis abc" produces: type = character(kind=1) (16) That is, gdb thinks that the variable abc is an array of length 16 with each component in the array being a singe character. I verified with the totalview debugger that the problem was with the compiler and not gdb. Interestingly enough, version 4.1.1 does *not* have this problem. This bug definitely makes debugging a program more painful.
I think this was recently fixed. At least with GCC 4.4.0 20090414 and with the latest 4.5 trunk: (gdb) pt abc type = character*16 (gdb) p abc $1 = 'abc', ' ' <repeats 13 times> I can reproduce the problem with gfortran 4.3.x
Fortran, P4. Confirmed as of comment #1.
Subject: Bug 39791 Author: burnus Date: Fri Apr 24 07:19:12 2009 New Revision: 146672 URL: http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=146672 Log: 2009-04-24 Tobias Burnus <burnus@net-b.de> PR fortran/39791 Backport from mainline: 2008-08-22 Jakub Jelinek <jakub@redhat.com> * dwarf2out.c (add_subscript_info): Stop on Fortran * TYPE_STRING_FLAG types. (gen_array_type_die): Emit DW_TAG_string_type for Fortran character types. Modified: branches/gcc-4_3-branch/gcc/ChangeLog branches/gcc-4_3-branch/gcc/dwarf2out.c
FIXED for 4.3.4. The original patch for the 4.4 trunk was http://gcc.gnu.org/ml/gcc-patches/2008-08/msg01700.html
The patch caused a regression, see PR 40061