This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
RE: Variable Length Arrays (VLA) proposal
- From: Chris January <chris dot january at allinea dot com>
- To: "Agovic, Sanimir" <sanimir dot agovic at intel dot com>
- Cc: "gdb at sourceware dot org" <gdb at sourceware dot org>, "Boell, Keven" <keven dot boell at intel dot com>, "Weinmann, Christoph T" <christoph dot t dot weinmann at intel dot com>
- Date: Thu, 04 Jul 2013 09:53:31 +0100
- Subject: RE: Variable Length Arrays (VLA) proposal
- References: <0377C58828D86C4588AEEC42FC3B85A7176288F9 at IRSMSX105 dot ger dot corp dot intel dot com> <1372434039 dot 2950 dot 12 dot camel at gumtree> <0377C58828D86C4588AEEC42FC3B85A71762A7F2 at IRSMSX105 dot ger dot corp dot intel dot com>
Hello Sanimir,
On Thu, 2013-07-04 at 08:17 +0000, Agovic, Sanimir wrote:
> Breakpoint 1, test () at vla.f90:4
> 4 ALLOCATE(vla (3, 4, 5))
> $1 = <not allocated>
> type = integer(kind=4), ALLOCATABLE (0:1,0:1,0:1)
> 5 ALLOCATE(character(len=2) :: str)
> $2 = (( ( 0, 0) ( 0, 0) ) ( ( 0, 0) ( 0, 0) ) )
I have had reports this happens with the Fedora version of gfortran
4.7.2 (but not with the Debian version, IIRC) - I will look into it.
> test () at vla.f90:6
> 6 vla(:,:,:) = 42
> Cannot access memory at address 0x6060c0
> warning: array or string index out of range
> valarith.c:63: internal-error: find_size_for_pointer_math: Assertion `TYPE_CODE (ptr_type) == TYPE_CODE_PTR' failed.
> [core dump]
The error is correct - the subscript is out of range (Fortran array
subscripts start at 1). Obviously the subsequent crash is not good - I
believe it occurs because GDB switches to 'C style' array indexing for
the Fortran string when the subscript is our of range, which doesn't
work and currently crashes.
Regards,
Chris