GDB 4.16 and G77: to print ARRAY(X, Y), use `print ARRAY(Y, X)'?
Andreas Zeller
zeller@ips.cs.tu-bs.de
Mon Jan 12 11:05:00 GMT 1998
Hi!
Using GDB 4.16 and G77 from egcs-1.0.1 on a sparc-sun-sunos4.1.4, it
turns out that I must write `print ARRAY(Y, X)' to print ARRAY(X, Y).
This is illustrated by the following example:
I have a piece of FORTRAN code `fbug.f', compiled with g77.
double precision b(0:2, 2:4)
b(0,2) = 66.00
end
Using GDB 4.16, I place a breakpoint after the assignment and stop there:
(gdb) b fbug.f:3
(gdb) run
Breakpoint 1, MAIN__ () at fbug.f:3
3 end
Current language: auto; currently fortran
(gdb)
Printing `b' just works fine, and we see that b(0, 2) - reported first -
has indeed been initialized:
(gdb) print b
$1 = (( 66, 1.9851886796434546e-314, 0)
(1.9851886164030519e-314, -3.1018262511099586e+231, 0)
( 0, 0, 4.4821635390717886e-320) )
(gdb)
However, printing b(0, 2) - which has just been assigned 66 - fails:
(gdb) print b(0, 2)
$2 = -3.1018262511099586e+231
(gdb)
Instead, to access b(0, 2), I must instruct GDB to print b(2, 0):
(gdb) print b(2, 0)
$3 = 66
(gdb)
I assume that either GDB's `print' command or `g77' get the ordering
of array indices wrong.
--
Andreas Zeller Technische Universitaet Braunschweig, Germany
mailto:zeller@acm.org http://www.cs.tu-bs.de/~zeller/
More information about the Gcc-bugs
mailing list