gdb does not show heap arrays in fortran
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
gdb |
Fix Released
|
Critical
|
|||
gdb (Debian) |
Confirmed
|
Unknown
|
|||
gdb (Ubuntu) |
Confirmed
|
Medium
|
Unassigned |
Bug Description
The problem description can be found in many places over the internet, e.g. here:
http://
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(
! read stuff
do i=1,ndata
my_stack(i) = real(i)
end do
my_heap = my_stack
my_
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)
Changed in gdb (Debian): | |
status: | Unknown → Confirmed |
Changed in gdb: | |
importance: | Unknown → Critical |
status: | Unknown → Fix Released |
Worked around by installing gdb from opensuse RPM package with alien.
It issues a lot of warnings and sometimes crashes, but nore or less usable in Ubuntu.