This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
RE: Variable Length Arrays (VLA) proposal
- From: "Agovic, Sanimir" <sanimir dot agovic at intel dot com>
- To: Chris January <chris dot january at allinea 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, 4 Jul 2013 08:17:53 +0000
- 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>
Hello Chris,
I tried gdb_dtd with gfortran to debug a vla sample, without success:
$ nl vla.f90
1 PROGRAM test
2 INTEGER, ALLOCATABLE :: vla(:, :, :)
3 CHARACTER(len=:), ALLOCATABLE :: str
4 ALLOCATE(vla (3, 4, 5))
5 ALLOCATE(character(len=2) :: str)
6 vla(:,:,:) = 42
7 str = '42'
8 call EXIT(0)
9 END PROGRAM test
gdb-72-ddt4.0-31457 / gfortran (4.7.2 20121109) / fedora 18
$ gdb_dtd vla -q -batch -ex "b 4" -ex run -ex "p vla" -ex "pt vla" -ex next -ex "p vla" -ex "adv 6" -ex "p str" -ex "p str(0)"
Breakpoint 1 at 0x40095e: file vla.f90, line 4.
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) ) )
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]
Upper/lower bounds are always 0:1, allocated character seem not work, character subscripts lead to core dump.
-Sanimir
> -----Original Message-----
> From: gdb-owner@sourceware.org [mailto:gdb-owner@sourceware.org] On Behalf Of Chris
> January
> Sent: Friday, June 28, 2013 05:41 PM
> To: gdb@sourceware.org
> Subject: Re: Variable Length Arrays (VLA) proposal
>
> Hello Sanimir,
>
> On Fri, 2013-06-28 at 13:01 +0000, Agovic, Sanimir wrote:
> > (1)
> > Resolving check_typedef:
>
> > (2)
> > Type normalization:
>
> > (3)
> > Split struct type:
>
> Just to add another possibility, we implemented VLA for Fortran by
> wrapping read_var_value and then adding a call to f_fixup_value which
> 'fixed up' the type of the variable (filled in the array bounds, etc.)
> by modifying the original type. (It also auto-dereferences pointers).
>
> Regards,
> Chris January - VP Engineering - Allinea Software Ltd.
>
Intel GmbH
Dornacher Strasse 1
85622 Feldkirchen/Muenchen, Deutschland
Sitz der Gesellschaft: Feldkirchen bei Muenchen
Geschaeftsfuehrer: Christian Lamprechter, Hannes Schwaderer, Douglas Lusk
Registergericht: Muenchen HRB 47456
Ust.-IdNr./VAT Registration No.: DE129385895
Citibank Frankfurt a.M. (BLZ 502 109 00) 600119052