Your message dated Sun, 27 Jul 2025 21:53:29 -0400
with message-id <[email protected]>
and subject line Closing
has caused the Debian Bug report #419798,
regarding gdb is not computing the array indexes correctly
to be marked as done.
This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.
(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)
--
419798: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=419798
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
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
--- End Message ---
--- Begin Message ---
I can't reproduce the bug anymore; it has been fixed:
--8<---------------cut here---------------start------------->8---
(gdb) p a(8)
$1 = 4
(gdb) p a(3)
no such vector element
--8<---------------cut here---------------end--------------->8---
I'm closing it now, but please reopen if it's still applicable.
Thanks,
--
Sergio
GPG key ID: 237A 54B1 0287 28BF 00EF 31F4 D0EB 7628 65FC 5E36
Please send encrypted e-mail if possible
https://sergiodj.net/
signature.asc
Description: PGP signature
--- End Message ---