← Back to team overview

touch-packages team mailing list archive

[Bug 1315634] Re: gdb does not show heap arrays in fortran

 

** Changed in: gdb (Debian)
       Status: Unknown => Confirmed

-- 
You received this bug notification because you are a member of Ubuntu
Touch seeded packages, which is subscribed to gdb in Ubuntu.
https://bugs.launchpad.net/bugs/1315634

Title:
  gdb does not show  heap arrays in fortran

Status in GNU Debugger:
  Unknown
Status in “gdb” package in Ubuntu:
  Confirmed
Status in “gdb” package in Debian:
  Confirmed

Bug description:
  The problem description can be found in many places over the internet, e.g. here:
  http://numericalnoob.blogspot.fi/2012/08/fortran-allocatable-arrays-and-pointers.html
  When debugging simple program

  program test
      integer, parameter :: ndata = 8, ndim = 2
      real :: my_stack(ndata)
      real, allocatable, target:: my_heap(:)
      real, pointer:: my_ptr(:,:,:)
      allocate(my_heap(ndata))
      ! read stuff
      do i=1,ndata
          my_stack(i) = real(i)
      end do
      my_heap = my_stack
      my_ptr(1:ndim,1:ndim,1:ndim) => my_heap
      write(*,*) my_stack
      write(*,*) my_heap
      write(*,*) my_ptr
  end program test

  With gdb from distro (GNU gdb (Ubuntu 7.7-0ubuntu3) 7.7) I get:

  ....
  Breakpoint 1, test () at test.f90:13
  13	    write(*,*) my_stack
  (gdb) p my_stack
  $1 = (1, 2, 3, 4, 5, 6, 7, 8)
  (gdb) p my_heap
  $2 = (0)
  (gdb) p my_ptr
  $3 = (( ( 0) ) )
  (gdb) 

  
  With properly compiled gdb on another computer (GNU gdb (GDB) SUSE (7.5.1-0.7.29)) i get 

  ....
  Breakpoint 1, test () at test.f90:13
  13	    write(*,*) my_stack
  (gdb) p my_stack
  $1 = (1, 2, 3, 4, 5, 6, 7, 8)
  (gdb) p my_heap
  $2 = (1, 2, 3, 4, 5, 6, 7, 8)
  (gdb) p my_ptr
  $3 = (( ( 1, 2) ( 3, 4) ) ( ( 5, 6) ( 7, 8) ) )
  (gdb)

To manage notifications about this bug go to:
https://bugs.launchpad.net/gdb/+bug/1315634/+subscriptions