From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10793 invoked by alias); 15 Mar 2010 17:13:35 -0000 Received: (qmail 10779 invoked by uid 22791); 15 Mar 2010 17:13:34 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 15 Mar 2010 17:13:30 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id E3B812BAB64; Mon, 15 Mar 2010 13:13:28 -0400 (EDT) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id ji2cCxuNpR7Z; Mon, 15 Mar 2010 13:13:28 -0400 (EDT) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id AF1652BAB43; Mon, 15 Mar 2010 13:13:28 -0400 (EDT) Received: by joel.gnat.com (Postfix, from userid 1000) id D8D76F5917; Mon, 15 Mar 2010 10:13:25 -0700 (PDT) Date: Mon, 15 Mar 2010 17:13:00 -0000 From: Joel Brobecker To: Chandru Cc: gdb-patches@sourceware.org Subject: Re: gdb can't print array element for fortran Message-ID: <20100315171325.GN3045@adacore.com> References: <201003121836.24712.chandru@in.ibm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <201003121836.24712.chandru@in.ibm.com> User-Agent: Mutt/1.5.20 (2009-06-14) 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/msg00545.txt.bz2 > This mail pertains to the discussion had on gdb mailing list sometime > back here http://sourceware.org/ml/gdb-patches/2009-01/msg00251.html. > After a small discussion with Jan I made the following changes and > these didn't seem to work. Any inputs or thoughts would be helpful. Does anyone else have an opinion on this patch. It looks wrong to me (sorry Chandru): Arrays with a high bound that's less than the low bound can exist, at least in Ada. It's just an empty array. I haven't looked at Jan's work for the Fortran VLA stuff in a while, so I can't remember how he dealt with this issue. But I think his approach might be more correct. > --- src/gdb/gdbtypes.c.orig 2010-02-25 00:00:19.000000000 +0530 > +++ src/gdb/gdbtypes.c 2010-02-25 00:03:16.000000000 +0530 > @@ -727,6 +727,14 @@ create_range_type (struct type *result_t > if (low_bound >= 0) > TYPE_UNSIGNED (result_type) = 1; > > + if (high_bound < low_bound) > + { > + if (high_bound == -1) > + TYPE_HIGH_BOUND_UNDEFINED(result_type) = 1; > + else > + TYPE_HIGH_BOUND_UNDEFINED(result_type) = 0; > + } > + > return result_type; > } > > --- src/gdb/valarith.c.orig 2010-02-25 00:00:26.000000000 +0530 > +++ src/gdb/valarith.c 2010-02-25 00:04:37.000000000 +0530 > @@ -198,7 +198,7 @@ value_subscripted_rvalue (struct value * > 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 || ((elt_offs >= TYPE_LENGTH (array_type)) && !TYPE_HIGH_BOUND_UNDEFINED(array_type))) > error (_("no such vector element")); > > v = allocate_value (elt_type); -- Joel