Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Lurkos <lurkos.usenet@gmail.com>
To: gdb@sources.redhat.com
Subject: cannot print allocatable arrays
Date: Fri, 23 Sep 2011 15:20:00 -0000	[thread overview]
Message-ID: <20110923144610.10149.52279.XPN@L622243018051.user.x-privat.org> (raw)

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


             reply	other threads:[~2011-09-23 15:20 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-23 15:20 Lurkos [this message]
2011-09-23 15:26 ` Jan Kratochvil
2011-10-04 19:00   ` Lurkos
2011-10-04 23:46     ` Lurkos
2011-09-23 15:32 ` Joachim Protze

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110923144610.10149.52279.XPN@L622243018051.user.x-privat.org \
    --to=lurkos.usenet@gmail.com \
    --cc=gdb@sources.redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox