From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 17980 invoked by alias); 10 Apr 2014 14:31:32 -0000 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 Received: (qmail 17968 invoked by uid 89); 10 Apr 2014 14:31:31 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.6 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.3.2 X-HELO: rock.gnat.com Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Thu, 10 Apr 2014 14:31:30 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 079261160C9; Thu, 10 Apr 2014 10:31:29 -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 qlSB3JxGDvZ6; Thu, 10 Apr 2014 10:31:28 -0400 (EDT) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id D399B1160A4; Thu, 10 Apr 2014 10:31:28 -0400 (EDT) Received: by joel.gnat.com (Postfix, from userid 1000) id C05C2E0E11; Thu, 10 Apr 2014 07:31:31 -0700 (PDT) Date: Thu, 10 Apr 2014 14:31:00 -0000 From: Joel Brobecker To: Sanimir Agovic Cc: gdb-patches@sourceware.org, tromey@redhat.com Subject: Re: [PATCH v6 10/15] vla: evaluate operand of sizeof if its type is a vla Message-ID: <20140410143131.GC15965@adacore.com> References: <1397133617-26681-1-git-send-email-sanimir.agovic@intel.com> <1397133617-26681-11-git-send-email-sanimir.agovic@intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1397133617-26681-11-git-send-email-sanimir.agovic@intel.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-SW-Source: 2014-04/txt/msg00180.txt.bz2 > 2014-02-05 Sanimir Agovic > Keven Boell > > * eval.c (evaluate_subexp_for_sizeof): Add enum noside argument. > (evaluate_subexp_standard): Pass noside argument. > (evaluate_subexp_for_sizeof) : Handle subscript case > if noside equals EVAL_NORMAL. If the subscript yields a vla type > re-evaluate subscript operation with EVAL_NORMAL to enable sideffects. > * gdbtypes.c (resolve_dynamic_bounds): Mark bound as evaluated. > * gdbtypes.h (enum range_flags): Add RANGE_EVALUATED case. > > testsuite/gdb.base/ > > * vla-sideeffect.c: New file. > * vla-sideeffect.exp: New file. Approved with some minor trivial modifications. > /* Evaluate a subexpression of EXP, at index *POS, > and return a value for the size of that subexpression. > - Advance *POS over the subexpression. */ > + Advance *POS over the subexpression. If NOSIDE is EVAL_NORMAL ^^^^^^^ Minor style nit: Two spaces after a period ("If NOSIDE") > + if (TYPE_RANGE_DATA (type)->flag_bound_evaluated) > + { > + val = evaluate_subexp (NULL_TYPE, exp, pos, EVAL_NORMAL); > + return value_from_longest > + (size_type, (LONGEST)TYPE_LENGTH (value_type (val))); I missed this one in the my first review, but there should be a space after "(LONGEST)". > +set sizeof_vla [ expr "10" * "$sizeof_int" ] > + > +gdb_test "print sizeof (vla1\[i++\])" "= ${sizeof_int}" \ Just to be consistent, let's add a space before the "=" sign. > + "print sizeof (vla1\[i++\])" Thanks, -- Joel