Package: gdb Version: 6.6.dfsg-1 Severity: normal Consider the following Fortran 90 program
$ cat array.f90 program array implicit none real :: a(5:8) a(5) = 1.0 a(6) = 2.0 a(7) = 3.0 a(8) = 4.0 write(*,*) a end program array All this program does is to initialize an array of 4 elements whose index starts from 5 and ends at 8. Program compiles and runs fine $ gfortran -g array.f90 $ ./a.out 1.000000 2.000000 3.000000 4.000000 However, when debugging, gdb works as if the array is from 0 to 3 instead of being from 5 to 8. This is very counter intuitive (atleast for Fortran programmers) where it is normal to start array indices from non-zero values. $ gdb -q ./a.out Using host libthread_db library "/lib/tls/libthread_db.so.1". (gdb) b 9 Breakpoint 1 at 0x8048599: file array.f90, line 9. (gdb) run Starting program: /home/rajuonu2/temp/a.out Breakpoint 1, MAIN__ () at array.f90:10 10 write(*,*) a Current language: auto; currently fortran (gdb) p a(8) $1 = -3.77869958e-10 (gdb) p a(3) $2 = 4 As you can see, gdb is printing 4 for a(3) where as it should be printing 4 for a(8) $ gdb --version GNU gdb 6.6-debian Copyright (C) 2006 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "i486-linux-gnu". $ gfortran --version GNU Fortran 95 (GCC) 4.1.2 20061115 (prerelease) (Debian 4.1.1-21) Copyright (C) 2006 Free Software Foundation, Inc. GNU Fortran comes with NO WARRANTY, to the extent permitted by law. You may redistribute copies of GNU Fortran under the terms of the GNU General Public License. For more information about these matters, see the file named COPYING hth raju -- System Information: Debian Release: testing/unstable APT prefers unstable APT policy: (500, 'unstable'), (500, 'stable') Architecture: i386 (i686) Shell: /bin/sh linked to /bin/bash Kernel: Linux 2.6.17-2-686 Locale: LANG=en_US, LC_CTYPE=en_US (charmap=ISO-8859-1) Versions of packages gdb depends on: ii libc6 2.3.6-15 GNU C Library: Shared libraries ii libncurses5 5.5-1 Shared libraries for terminal hand ii libreadline5 5.2-2 GNU readline and history libraries gdb recommends no packages. -- no debconf information -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]