From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 3768 invoked by alias); 14 Jul 2005 23:46:20 -0000 Mailing-List: contact gdb-patches-help@sources.redhat.com; run by ezmlm Precedence: bulk List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sources.redhat.com Received: (qmail 3757 invoked by uid 22791); 14 Jul 2005 23:46:16 -0000 Received: from nevyn.them.org (HELO nevyn.them.org) (66.93.172.17) by sourceware.org (qpsmtpd/0.30-dev) with ESMTP; Thu, 14 Jul 2005 23:46:16 +0000 Received: from drow by nevyn.them.org with local (Exim 4.52) id 1DtDPB-0005hz-Hv; Thu, 14 Jul 2005 19:46:13 -0400 Date: Thu, 14 Jul 2005 23:46:00 -0000 From: Daniel Jacobowitz To: Wu Zhou Cc: gdb-patches@sources.redhat.com Subject: Re: [RFA] New testcase to evaluate Fortran substring expression Message-ID: <20050714234612.GA21620@nevyn.them.org> Mail-Followup-To: Wu Zhou , gdb-patches@sources.redhat.com References: <20050703185733.GI13811@nevyn.them.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.8i X-SW-Source: 2005-07/txt/msg00120.txt.bz2 On Fri, Jul 08, 2005 at 12:54:21AM +0800, Wu Zhou wrote: > The original thought of mine is to not add any new operators. The problem > of this idea is how to transfer the lowerbound (or upperbound or both) of > the prefixed array expression? Any ideas on this? > > Now I coded a patch (attached below) to add four new operators for F90 > subrange: OP_F90_RANGE_NORMAL, OP_F90_RANGE_DFT_END, OP_F90_RANGE_DFT_START > and OP_F90_RANGE_DFT_ALL. The code of evaluating sub-array is also added > and the code of substring evaluation is updated to use the former > (sub-array evaluation). Would you please comment on this patch? First of all, why do you need four operators? I'd just use one, and push some sentinel value for the empty boundary case. I'm not sure if you can use NULL in this context, but if you can, that'd work nicely. > ! arglist : subrange > ! { } > ; > IIRC empty actions can just be skipped. > ! arglist : arglist ',' arglist %prec ABOVE_COMMA > { arglist_len++; } > ; > The old grammar was: arglist: /* empty */ | exp | substring | arglist ',' exp substring: exp ':' exp So "1, 1" "1:1", "1:1,1", "1:1,1,1" were all valid arglists. I don't know Fortran, but I'm guessing this is intended, for multidimensional arrays? The new grammar is: arglist : /* empty */ | exp | subrange | arglist ',' arglist subrange : exp ':' exp | exp ':' | ':' exp | ':' One big problem here: I would have assumed bison would have bumped up the number of conflicts reported here. Maybe it doesn't because of the %prec. But you probaby don't want arglist ',' arglist. It has all sorts of quirks; for instance, it allows "," as an arglist with two elements. If what you are trying to do is allow "1:1, 1:1" then you want: arglist : /* empty */ | exp | subrange | arglist ',' exp | arglist ',' subrange -- Daniel Jacobowitz CodeSourcery, LLC