[Bug fortran/34276] New: GDB shows wrong value of array elements.
abidh at sourceware dot org via Gdb-prs <[email protected]>
| Newsgroups | gmane.comp.gdb.bugs.discuss |
|---|---|
| Message-ID | <[email protected]/bugzilla/> |
https://sourceware.org/bugzilla/show_bug.cgi?id=34276
Bug ID: 34276
Summary: GDB shows wrong value of array elements.
Product: gdb
Version: HEAD
Status: NEW
Severity: normal
Priority: P2
Component: fortran
Assignee: unassigned at sourceware dot org
Reporter: abidh at sourceware dot org
Target Milestone: ---
$ cat test.f90
program test
implicit none
type :: arr
integer, allocatable :: f (:)
end type
type(arr), dimension(2) :: keys
allocate (keys(1)%f(2))
allocate (keys(2)%f(3))
keys(1)%f(1) = 1
keys(1)%f(2) = 2
keys(2)%f(1) = 3
keys(2)%f(2) = 4
keys(2)%f(3) = 5
print *, keys(1)%f(1)
print *, keys(2)%f(1)
$ gfortran -g -o test test.f90
$ gdb -q test
Reading symbols from test...
(gdb) b 16
Breakpoint 1 at 0x146f: file test.f90, line 16.
(gdb) r
...
Breakpoint 1, test () at test.f90:16
16 print *, keys(1)%f(1)
(gdb) p keys(1)
$1 = ( f = (1, 2) )
(gdb) p keys(2)
$2 = ( f = (3, 4, 5) )
(gdb) p keys
$3 = (( f = (1, 2) ), ( f = (1, 2) ))
Notice the difference when keys(2) and keys are printed. In case of keys, the
2nd dimension is wrong. GDB is duplicating values from the first dimension.
--
You are receiving this mail because:
You are on the CC list for the bug.