fortran/2290: can not acces allocatable array in fortran90
virginie.trinite@thalesgroup.com
virginie.trinite@thalesgroup.com
Thu Jul 26 09:28:00 GMT 2007
>Number: 2290
>Category: fortran
>Synopsis: can not acces allocatable array in fortran90
>Confidential: no
>Severity: non-critical
>Priority: medium
>Responsible: unassigned
>State: open
>Class: sw-bug
>Submitter-Id: net
>Arrival-Date: Thu Jul 26 09:28:01 UTC 2007
>Closed-Date:
>Last-Modified:
>Originator: virginie.trinite@thalesgroup.com
>Release: GNU gdb Red Hat Linux (6.5-16.el5rh)
>Organization:
>Environment:
>Description:
In this very simple program, you can have acces to tab2 but not to tab:
program ex
implicit none
integer :: i
real(8),allocatable :: tab(:)
real(8) :: tab2(10)
allocate(tab(1:10))
do i=1,10
tab(i)=real(i,8)
tab2(i)=tab(i)
end do
end program ex
I have use both g95 and gfortran
when I use print tab2 every things are fine
(a part that g95 sems to not be regonize as fortran, and that the first index is always zero,and not one)
but if I want to acces to tab:
in gfortran
(gdb) p tab
$2 = { 0x1b7a8460, -1, 537, ({ 1, 1, 10})}
(gdb) p tab(1)
Cannot perform substring on this type
(gdb) p tab[1]
A syntax error in expression, near `[1]'.
(gdb) whatis tab
type = Type array_descriptor1
PTR TO -> ( VOID ) :: data
int8 :: offset
int8 :: dtype
Type descriptor_dimension
int8 :: stride
int8 :: lbound
int8 :: ubound
End Type descriptor_dimension (0:0) :: dim
End Type array_descriptor1
(gdb) p tab%data(1)
Program received signal SIGSEGV, Segmentation fault.
0x000000001b7a8460 in ?? ()
in g95
(gdb) p tab
$1 = {offset = 0x15a39330 "P", rank = 1, esize = 8, base = 0x15a39338, info = {8, 1, 10}}
(gdb) p tab(1)
Invalid data type for function to be called.
(gdb) p tab[1]
Structure has no component named operator[].
(gdb) p tab.base[1]
Attempt to dereference a generic pointer.
(gdb) p tab.offset[1]
$4 = 0 '\0'
>How-To-Repeat:
>Fix:
>Release-Note:
>Audit-Trail:
>Unformatted:
More information about the Gdb-prs
mailing list