gcc/gdb/multidimensional arrays
David Haynor
haynor@u.washington.edu
Tue Jun 11 23:21:00 GMT 2002
hi gcc help,
i recently installed gcc/g77 3.0.4 and gdb 5.2 in /usr/local/bin and
/usr/local/lib. there are older versions of gcc/g77 (2.95) and gdb (5.0)
in /usr/bin and /usr/lib.
i set my $path to point to /usr/local/bin first and the which command
shows me that i am running those copies of gcc/g77 and gdb; and the -v
commands to gcc, g77, and gdb give the expected results.
consider the following simple program:
program testDB
implicit none
real d1(10),d2(10,20)
integer i,j
do i = 1,10
d1(i) = 1.0d0
do j = 1,20
d2(i,j) = 2.0d0
enddo
enddo
d1(5) = 55.
d2(1,2) = 12.0
print *,d1(5),d2(1,2)
pause
stop
end
if i run it, it prints out 55 and 12 as expected. however, if i use gdb
to inspect d1(5) and d2(1,2), the value for d1(5) is correct (55), but the
value of d2(1,2) is not correct. the gdb command set d2(1,2) = 1, say,
runs without complaint, but the printed output of the program is still 55
and 12. i conclude that the address of d2(1,2) is not getting correctly
calculated by gdb.
is there any fix for this? i've found mentions of a similar problem in
old discussion groups, but nothing recent, and nothing in the gnu pages.
is it possible that there is another library that needs to be updated, or
some reason why having the two versions coexisting is a problem?
thanks in advance for your help; the whole project will have to be
abandoned if we can't get the debugger to work properly.
-dh
More information about the Gcc-help
mailing list