multidimensional fortran arrays

Andrew Burgess aburgess@broadcom.com
Tue Sep 14 07:32:00 GMT 2010


> On Tue, Sep 14, 2010 at 00:14, Mathew Yeates <mat.yeates@gmail.com>
> 
> uh oh. Doesn't seem to work for dimensions greater than 2.

Could you attach a test program, steps to compile, and the gdb commands and output please.
The following test program:

program a
  integer :: foo1 (2)
  integer :: foo2 (2,3)
  integer :: foo3 (2,3,4)
  integer :: foo4 (2,3,4,5)
  integer :: foo5 (2,3,4,5,6)
  integer :: foo6 (2,3,4,5,6,7)
  foo1 (:) = 10
  foo2 (:, :) = 10
  foo3 (:, :, :) = 10
  foo4 (:, :, :, :) = 10
  foo5 (:, :, :, :, :) = 10
  foo6 (:, :, :, :, :, :) = 10
  foo1 (2) = 20
  foo2 (2,3) = 20
  foo3 (2,3,4) = 20
  foo4 (2,3,4,5) = 20
  foo5 (2,3,4,5,6) = 20
  foo6 (2,3,4,5,6,7) = 20
  foo1 (2) = 20 ! Stop on line 20
end

Behaves like this with a patched gdb:

Reading symbols from /home/andrew/gdb-bug/myprog.x...done.
(gdb) b 20
Breakpoint 1 at 0x8048847: file a.f90, line 20.
(gdb) r
Starting program: /home/andrew/gdb-bug/myprog.x 

Breakpoint 1, a () at a.f90:20
20	  foo1 (2) = 20 ! Stop on line 20
 (gdb) p foo6(2,3,4,5,6,7)
$3 = 20
(gdb) p foo1(2)
$4 = 20
(gdb)


So I suspect we're trying to do different things.

Cheers,

Andrew



More information about the Gdb mailing list