[Bug fortran/9395] can not acces allocatable array in fortran90

joachim.protze at zih dot tu-dresden.de sourceware-bugzilla@sourceware.org
Wed Feb 16 16:51:00 GMT 2011


http://sourceware.org/bugzilla/show_bug.cgi?id=9395

--- Comment #5 from Joachim Protze <joachim.protze at zih dot tu-dresden.de> 2011-02-16 16:51:11 UTC ---
Created attachment 5246
  --> http://sourceware.org/bugzilla/attachment.cgi?id=5246
fortran program with 3d-array

I checked out the branch and found some strange behavior regarding subarrays
and at last gdb segfaulted:

(gdb) b 18
Breakpoint 1 at 0x400aae: file array-segf.f90, line 18.
(gdb) r
Starting program: array-segf 

Breakpoint 1, typesubarray () at array-segf.f90:18
18      buffer=100
(gdb) p buffer
$1 = (( ( 0, 1, 2, 3) ( 4, 5, 6, 7) ( 8, 9, 10, 11) ( 12, 13, 14, 15) ) ( ( 16,
17, 18, 19) ( 20, 21, 22, 23) ( 24, 25, 26, 27) ( 28, 29, 30, 31) ) ( ( 32, 33,
34, 35) ( 36, 37, 38, 39) ( 40, 41, 42, 43) ( 44, 45, 46, 47) ) ( ( 48, 49, 50,
51) ( 52, 53, 54, 55) ( 56, 57, 58, 59) ( 60, 61, 62, 63) ) )
(gdb) p buffer(:,:,0)
$2 = (( 0, 1, 2, 3) ( 4, 5, 6, 7) ( 8, 9, 10, 11) ( 12, 13, 14, 15) )
(gdb) p buffer(:,:,1)
$3 = (( 0, 1, 2, 3) ( 4, 5, 6, 7) ( 8, 9, 10, 11) ( 12, 13, 14, 15) )
(gdb) p buffer(:,:,4)
no such vector element
(gdb) p buffer(:,0,0)
$4 = (0, 1, 2, 3)
(gdb) p buffer(:,2,3)
$5 = (0, 1, 2, 3)
(gdb) p buffer(1,:,3)
$6 = (0, 4, 8, 12)
(gdb) p buffer(2:3,0,0)
$7 = (0, 1)
(gdb) p buffer(3,1,:)
segfault


The subarrays that are printed are choosen wrong. Size and dimension are
choosen right, but all subarrays are aligned to (0,0,0).
If the first dimension (last digit) is set to range, gdb always segfaults.

GNU Fortran (Ubuntu 4.4.3-4ubuntu5) 4.4.3
GNU gdb (GDB) 7.2.50.20110213-cvs

-- 
Configure bugmail: http://sourceware.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.



More information about the Gdb-prs mailing list