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.


-- 
           Summary: Bad Dwarf debug information from gfortran for a
                    character string.
           Product: gcc
           Version: 4.3.3
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: fortran
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: david dot sagan at gmail dot com


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=39791

Reply via email to