This is the mail archive of the gdb@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

cannot print allocatable arrays


I'm using gdb 7.0.1-debian and gfortran 4.4.5 on Debian squeeze amd64.

I'm not able to print arrays that are declared as allocatable.
It seems that gdb is not able to detect the correct size of the array
allocated run-time.
Is there a different way to print the values in this case?

Thank you.

+++ Test case 1: allocatable array +++
---------- code ----------
program arrshow
  implicit none
  integer,parameter :: n = 5
  integer,allocatable,dimension(:) :: vect
  integer :: i

  allocate(vect(n))

  do i=1,n
    vect(i) = i
  enddo
  
  write(unit=*,fmt=*) vect
  
  deallocate(vect)
endprogram arrshow
---------- gdb ----------
(gdb) p vect
$1 = ()
(gdb) ptype vect
type = integer(kind=4) (0:-1)

+++ Test case 2: static array +++
---------- code ----------
program arrshow
  implicit none
  integer,parameter :: n = 5
  integer,dimension(n) :: vect
  integer :: i

  do i=1,n
    vect(i) = i
  enddo
  
  write(unit=*,fmt=*) vect
endprogram arrshow
---------- gdb ----------
(gdb) p vect
$1 = (1, 2, 3, 4, 5)
(gdb) ptype vect
type = integer(kind=4) (5)

-- 
Lurkos


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]