This is the mail archive of the
gdb-prs@sources.redhat.com
mailing list for the GDB project.
gdb/648: Indexing is incorrect for printing elements of multi-dimensional FORTRAN (g77) array
- From: mark dot e dot smith at arnold dot af dot mil
- To: gdb-gnats at sources dot redhat dot com
- Date: 14 Aug 2002 14:38:24 -0000
- Subject: gdb/648: Indexing is incorrect for printing elements of multi-dimensional FORTRAN (g77) array
- Reply-to: mark dot e dot smith at arnold dot af dot mil
>Number: 648
>Category: gdb
>Synopsis: Indexing is incorrect for printing elements of multi-dimensional FORTRAN (g77) array
>Confidential: no
>Severity: serious
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Wed Aug 14 07:48:04 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator: mark.e.smith@arnold.af.mil
>Release: GNU gdb Red Hat Linux (5.2-2)
>Organization:
>Environment:
Red Hat 7.2 -- Linux 2.4.7-10 #1 Thu Sep 6 17:27:27 EDT 2001 i686 unknown
g77 version 2.96 20000731
This GDB was configured as "i386-redhat-linux"...
>Description:
When printing an element from a multi-dimensional array the second (and higher?) subscript uses the wrong increment into the memory. The increment used is the one from the dimension for that subscript. The proper increment should be the one from the first subscript. Note: for the third subscript the proper increment would be first_dimension*second_dimension, etc.
>How-To-Repeat:
Sample program
dimension a(3,4)
data a/1,2,3,4,5,6,7,8,9,10,11,12/
do i = 1,3
print*, (a(i,j),j=1,4)
enddo
end
(gdb) p a(1,2)
$1 = 5 (Should be 4. The second subscript has incremented by 4 rather than 3. See below.)
(gdb) p a(4,1)
$2 = 4 (This is the correct value for a(1,2).)
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted: