From: kamaraju kusumanchi <raju.mailinglists@gmail.com>
To: gdb@sourceware.org
Cc: fortran@gcc.gnu.org
Subject: display character strings in fortran
Date: Wed, 10 Jun 2009 11:34:00 -0000 [thread overview]
Message-ID: <1d9315cf0906100433i238c735i63a94973050bfe6e@mail.gmail.com> (raw)
Consider the following code. (This is a reduced version of a large
code that I am working with.)
$cat char_string.f90
program string_size
implicit none
character (len=20) :: first_name
write(first_name, *) 'kamaraju'
write(*,*) first_name
end program string_size
The program compiles and runs fine.
$gfortran -g char_string.f90
$./a.out
kamaraju
However, when debugged, the character strings are not displayed properly.
$gdb ./a.out
Using host libthread_db library "/lib/i686/cmov/libthread_db.so.1".
(gdb) b char_string.f90:5
Breakpoint 1 at 0x8048620: file char_string.f90, line 5.
(gdb) r
Starting program: /home/rajulocal/work/fortran/a.out
Breakpoint 1, string_size () at char_string.f90:5
5 write(*,*) first_name
Current language: auto; currently fortran
(gdb) p first_name
$1 = (32 ' ', 107 'k', 97 'a', 109 'm', 97 'a', 114 'r', 97 'a', 106
'j', 117 'u', 32 ' ', 32 ' ', 32 ' ', 32 ' ', 32 ' ', 32 ' ', 32 ' ',
32 ' ', 32 ' ', 32 ' ', 32 ' ')
(gdb) quit
The program is running. Exit anyway? (y or n) y
I am using a Debian Etch machine running
$gfortran -v
Using built-in specs.
Target: i486-linux-gnu
Configured with: ../src/configure -v --with-pkgversion='Debian
4.3.2-1.1' --with-bugurl=file:///usr/share/doc/gcc-4.3/README.Bugs
--enable-languages=c,c++,fortran,objc,obj-c++ --prefix=/usr
--enable-shared --with-system-zlib --libexecdir=/usr/lib
--without-included-gettext --enable-threads=posix --enable-nls
--with-gxx-include-dir=/usr/include/c++/4.3 --program-suffix=-4.3
--enable-clocale=gnu --enable-libstdcxx-debug --enable-objc-gc
--enable-mpfr --enable-targets=all --enable-cld
--enable-checking=release --build=i486-linux-gnu --host=i486-linux-gnu
--target=i486-linux-gnu
Thread model: posix
gcc version 4.3.2 (Debian 4.3.2-1.1)
$gdb -v
GNU gdb 6.4.90-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".
Is this a bug in gdb or gfortran? I appreciate if you could fix it.
thanks
raju
next reply other threads:[~2009-06-10 11:34 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-06-10 11:34 kamaraju kusumanchi [this message]
2009-06-10 11:50 ` Arjen Markus
2009-06-10 11:56 Tobias Burnus
2009-06-10 12:19 ` kamaraju kusumanchi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1d9315cf0906100433i238c735i63a94973050bfe6e@mail.gmail.com \
--to=raju.mailinglists@gmail.com \
--cc=fortran@gcc.gnu.org \
--cc=gdb@sourceware.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox