Printing allocatable v.s. normal arrays from fortran code in GDB

Morten Olsen Lysgaard <[email protected]>
Newsgroups gmane.comp.gdb.devel
Message-ID <CAOujwNHOY0vBWNL7aMzhPxZu0cBPR_t8URT94Vz3OCOnY+aiXw@mail.gmail.com>
I am writing some scientific fortran code where I have some allocatable arrays.
When I want to print them in GDB, the data I get is gibberish, even
though the program itself easily can compute with the allocated array.
To demonstrate the problem I have created a small archive containing a
test program, a makefile and the output generated when run on my
system.
The program is alloc.f90
The output is is output.txt
The program can be compiled and run by running make on a system with
gfortran installed.
Because the mailing list doesn't support attatchments the tarfile is
available at (1 Kb)
https://www.dropbox.com/s/zj4pgcbp44p5q4z/alloc.tar.gz?dl=1

The interesting part is line 22-23 in output.txt. I would expect the
output on the two lines to be the same, but for some reason the
allocatable array is printed wrong.

Is this a known problem? Am I misunderstanding how allocatable arrays
work? Any help would be greatly appreciated.

GDB version: GNU gdb (Ubuntu 7.7.1-0ubuntu5~14.04.2) 7.7.1
gfortran version: GNU Fortran (Ubuntu 4.9.2-0ubuntu1~14.04) 4.9.2

Have a nice day - Morten
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.