From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 18465 invoked by alias); 15 Mar 2010 23:46:21 -0000 Received: (qmail 18452 invoked by uid 22791); 15 Mar 2010 23:46:20 -0000 X-SWARE-Spam-Status: No, hits=-7.2 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 15 Mar 2010 23:46:17 +0000 Received: from int-mx05.intmail.prod.int.phx2.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.18]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o2FNjoB8021560 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK); Mon, 15 Mar 2010 19:45:50 -0400 Received: from host0.dyn.jankratochvil.net (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx05.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o2FNjl39019957 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 15 Mar 2010 19:45:49 -0400 Received: from host0.dyn.jankratochvil.net (localhost [127.0.0.1]) by host0.dyn.jankratochvil.net (8.14.3/8.14.3) with ESMTP id o2FNjkJn026063; Tue, 16 Mar 2010 00:45:46 +0100 Received: (from jkratoch@localhost) by host0.dyn.jankratochvil.net (8.14.3/8.14.3/Submit) id o2FNjiN9026048; Tue, 16 Mar 2010 00:45:44 +0100 Date: Mon, 15 Mar 2010 23:46:00 -0000 From: Jan Kratochvil To: Tom Tromey Cc: Joel Brobecker , Chandru , gdb-patches@sourceware.org Subject: Re: gdb can't print array element for fortran Message-ID: <20100315234543.GA25216@host0.dyn.jankratochvil.net> References: <201003121836.24712.chandru@in.ibm.com> <20100315171325.GN3045@adacore.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.20 (2009-08-17) X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2010-03/txt/msg00566.txt.bz2 On Mon, 15 Mar 2010 21:51:48 +0100, Tom Tromey wrote: > Joel> I haven't looked at Jan's work for the Fortran VLA stuff in a while, > Joel> so I can't remember how he dealt with this issue. But I think his > Joel> approach might be more correct. > > I too have lost track of this, but my impression is that Jan's current > patch is rather larger. The VLA patch of mine does a real calculation of the dynamic sizes. This patch just considers dynamically-sized arrays as unbound. This patch will be superseded by the VLA patch. But I do not have the VLA patch ready now in a suitable form for FSF GDB. Fixed the Chandru's patch if this partial functionality is enough on its own. No regressions on {x86_64,x86_64-m32,i686}-fedora12-linux-gnu. The functionality is already tested by the testsuite so the patch does: -FAIL: gdb.fortran/array-element.exp: print the first element of array a +PASS: gdb.fortran/array-element.exp: print the first element of array a Thanks, Jan 2010-03-16 Jan Kratochvil Chandru * dwarf2read.c (read_subrange_type): Set TYPE_HIGH_BOUND_UNDEFINED. * valarith.c (value_subscripted_rvalue): Suppress error if TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED. --- a/gdb/dwarf2read.c +++ b/gdb/dwarf2read.c @@ -6074,6 +6074,9 @@ read_subrange_type (struct die_info *die, struct dwarf2_cu *cu) range_type = create_range_type (NULL, base_type, low, high); + if (attr && attr->form == DW_FORM_block1) + TYPE_HIGH_BOUND_UNDEFINED (range_type) = 1; + name = dwarf2_name (die, cu); if (name) TYPE_NAME (range_type) = name; --- a/gdb/valarith.c +++ b/gdb/valarith.c @@ -198,7 +198,8 @@ value_subscripted_rvalue (struct value *array, LONGEST index, int lowerbound) unsigned int elt_offs = elt_size * longest_to_int (index - lowerbound); struct value *v; - if (index < lowerbound || elt_offs >= TYPE_LENGTH (array_type)) + if (index < lowerbound || (!TYPE_ARRAY_UPPER_BOUND_IS_UNDEFINED (array_type) + && elt_offs >= TYPE_LENGTH (array_type))) error (_("no such vector element")); v = allocate_value (elt_type);