[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
gdb crashes after 'print *x' for fortran assumed size arrays
From: |
Jeroen Makkinje |
Subject: |
gdb crashes after 'print *x' for fortran assumed size arrays |
Date: |
Fri, 12 Jan 2001 12:44:21 +0100 |
User-agent: |
Mutt/1.2.5i |
In fortran one may use an asterisk if the size of
an array is unknown. However when evaluating the
array gdb crashes. To illustrate this I have made
the following program. The session below illustrate
what goes wrong.
I hope you can reproduce the error and fix the pro-
gram.
Greetings Jeroen Makkinje
(gdb) list test.f:1
1 PROGRAM TEST
2 Double Precision Av, X(10)
3 Integer I
4 Do 10 i = 1, 10
5 X(i) = 1.0D0 * i
6 10 Continue
7 Call CalcAv(Av, X,10)
8 print *, Av
9 End
10
(gdb) list
11 Subroutine CalcAv(Aver, xrange, j)
12 integer j
13 double precision Aver, xrange(*)
14 Aver = 0.0D0
15 Do 10 i = 1, j
16 Aver = Aver + xrange(i)
17 10 Continue
18 Aver = Aver / j
19 Return
20 End
(gdb) break 16
Breakpoint 1 at 0x8048f44: file test.f, line 16.
(gdb) run
Starting program: /home/jeroen/gdbtest/a.out
Breakpoint 1, calcav_ (aver=0xbffff858, xrange=0xbffff800, j=0x804f928)
at test.f:16
16 Aver = Aver + xrange(i)
Current language: auto; currently fortran
(gdb) print xrange
$1 = (PTR TO -> ( real*8 (-1))) 0xbffff800
(gdb) print *xrange
Segmentation fault (core dumped)
The problem is discovered when using ddd. When accidently moving
the mouse cursor over such so-called "assumed size array" the gdb
compiler crashes by ddd issues a output * command.
Greetings Jeroen Makkinje
+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
The program:
============
PROGRAM TEST
Double Precision Av, X(10)
Integer I
Do 10 i = 1, 10
X(i) = 1.0D0 * i
10 Continue
Call CalcAv(Av, X,10)
print *, Av
End
Subroutine CalcAv(Aver, xrange, j)
integer j
double precision Aver, xrange(*)
Aver = 0.0D0
Do 10 i = 1, j
Aver = Aver + xrange(i)
10 Continue
Aver = Aver / j
Return
End
Additional information:
=======================
GNU gdb 5.0
Copyright 2000 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 "i386-redhat-linux".
g77 version 2.96 20000731 (Red Hat Linux 7.0) (from FSF-g77 version 0.5.26
20000731 (Red Hat Linux 7.0))
Driving: g77 -v -c -xf77-version /dev/null -xnone
Reading specs from /usr/lib/gcc-lib/i386-redhat-linux/2.96/specs
gcc version 2.96 20000731 (Red Hat Linux 7.0)
/usr/lib/gcc-lib/i386-redhat-linux/2.96/tradcpp0 -lang-fortran -v -D__GNUC__=2
-D__GNUC_MINOR__=96 -D__GNUC_PATCHLEVEL__=0 -D__ELF__ -Dunix -Dlinux -D__ELF__
-D__unix__ -D__linux__ -D__unix -D__linux -Asystem(posix) -Acpu(i386)
-Amachine(i386) -Di386 -D__i386 -D__i386__ -D__tune_i386__ /dev/null /dev/null
GNU traditional CPP version 2.96 20000731 (Red Hat Linux 7.0)
/usr/lib/gcc-lib/i386-redhat-linux/2.96/f771 -fnull-version -quiet -dumpbase
g77-version.f -version -fversion -o /tmp/ccpfdudt.s /dev/null
GNU F77 version 2.96 20000731 (Red Hat Linux 7.0) (i386-redhat-linux) compiled
by GNU C version 2.96 20000731 (Red Hat Linux 7.0).
GNU Fortran Front End version 0.5.26 20000731 (Red Hat Linux 7.0)
as -V -Qy -o /tmp/ccQaUKIN.o /tmp/ccpfdudt.s
GNU assembler version 2.10.90 (i386-redhat-linux) using BFD version 2.10.0.18
ld -m elf_i386 -dynamic-linker /lib/ld-linux.so.2 -o /tmp/ccjjzXX9
/tmp/ccQaUKIN.o /usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../crt1.o
/usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../crti.o
/usr/lib/gcc-lib/i386-redhat-linux/2.96/crtbegin.o
-L/usr/lib/gcc-lib/i386-redhat-linux/2.96
-L/usr/lib/gcc-lib/i386-redhat-linux/2.96/../../.. -lg2c -lm -lgcc -lc -lgcc
/usr/lib/gcc-lib/i386-redhat-linux/2.96/crtend.o
/usr/lib/gcc-lib/i386-redhat-linux/2.96/../../../crtn.o
/tmp/ccjjzXX9
__G77_LIBF77_VERSION__: 0.5.26 20000731 (prerelease)
@(#)LIBF77 VERSION 19991115
__G77_LIBI77_VERSION__: 0.5.26 20000731 (prerelease)
@(#) LIBI77 VERSION pjw,dmg-mods 19991115
__G77_LIBU77_VERSION__: 0.5.26 20000731 (prerelease)
@(#) LIBU77 VERSION 19980709
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- gdb crashes after 'print *x' for fortran assumed size arrays,
Jeroen Makkinje <=
- Prev by Date:
,L.E-G,A.L; ,C.A-B`L`E, .B-O`X` ;D`E`S,C;R,A.MB;L,E.R- S,E.E; A-L`L` `T`H`E` `CH-A;NN.EL,S;,;,;;,,;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 4252
- Next by Date:
Problem with argumentless 'break' on GDB5
- Previous by thread:
,L.E-G,A.L; ,C.A-B`L`E, .B-O`X` ;D`E`S,C;R,A.MB;L,E.R- S,E.E; A-L`L` `T`H`E` `CH-A;NN.EL,S;,;,;;,,;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 4252
- Next by thread:
Problem with argumentless 'break' on GDB5
- Index(es):