This is the mail archive of the gdb-prs@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

gdb/1890: gdb AND fortran arrays


>Number:         1890
>Category:       gdb
>Synopsis:       gdb  AND fortran arrays
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    unassigned
>State:          open
>Class:          doc-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Mar 06 15:38:00 UTC 2005
>Closed-Date:
>Last-Modified:
>Originator:     ilias@utcpd.sk
>Release:        gdb 6.0 post
>Organization:
>Environment:
PC Linux
>Description:
Hello,

we have a matrix A(2,2) (see attachement) in the g77 code passed to subprogram.

In the main program we see the matrix elements according to the indexes correctly, e.g. "p A(1,2)" gives 2.

However, in the subroutine we don't have correct indexing:
 "p (*A)(1,2)" gives 3 and "p (*A)(2,2)" gives 2 instead of 4.

In the main program "whatis a" gives "type=real*4(2,2)" but in the routine we get "type=real*4(1,1)" after "whatis *a".

And finally, if we type uncorrectly "p a(1,1)" in the subroutine, we get message of SIGSEGV, Segmentation fault and we can not continue in debugging. We have to start from the beginning.
>How-To-Repeat:

>Fix:

>Release-Note:
>Audit-Trail:
>Unformatted:
----gnatsweb-attachment----
Content-Type: text/plain; name="array.f"
Content-Disposition: inline; filename="array.f"

      PROGRAM array_gdb
        REAL A(2,2)   
         INTEGER N,i,j

         N=2

         DO i=1,N
         DO j=1,N
          A(i,j)=(i-1)*N+j
          WRITE(*,*) 'main prog: A(',i,';',j,')=',A(i,j)
         END DO
         END DO

         CALL SUBMTX(A,N)

         STOP 0
         END

         SUBROUTINE SUBMTX(A,N)
         INTEGER N,i,j
         REAL A(N,N)
         DO i=1,N
         DO j=1,N
          WRITE(*,*) 'subroutine: A(',i,';',j,')=',A(i,j)
         END DO
         END DO

      RETURN
      END


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]