From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11639 invoked by alias); 21 Oct 2013 14:40:39 -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 11584 invoked by uid 89); 21 Oct 2013 14:40:39 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.2 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mga03.intel.com Received: from mga03.intel.com (HELO mga03.intel.com) (143.182.124.21) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 21 Oct 2013 14:40:37 +0000 Received: from azsmga001.ch.intel.com ([10.2.17.19]) by azsmga101.ch.intel.com with ESMTP; 21 Oct 2013 07:40:36 -0700 X-ExtLoop1: 1 Received: from irvmail001.ir.intel.com ([163.33.26.43]) by azsmga001.ch.intel.com with ESMTP; 21 Oct 2013 07:40:35 -0700 Received: from ulliclel001.iul.intel.com (ulliclel001.iul.intel.com [172.28.50.199]) by irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id r9LEeYtY030723 for ; Mon, 21 Oct 2013 15:40:34 +0100 Received: from ulliclel001.iul.intel.com (localhost [127.0.0.1]) by ulliclel001.iul.intel.com (8.14.4/8.12.8/MailSET/client) with ESMTP id r9LEeYnx021124 for ; Mon, 21 Oct 2013 16:40:34 +0200 Received: (from sagovic@localhost) by ulliclel001.iul.intel.com (8.14.4/8.12.8/MailSET/Submit) id r9LEeX3Q021123 for gdb-patches@sourceware.org; Mon, 21 Oct 2013 16:40:33 +0200 From: Sanimir Agovic To: gdb-patches@sourceware.org Subject: [PATCH 05/10] vla: allow side effects for sizeof argument Date: Mon, 21 Oct 2013 14:40:00 -0000 Message-Id: <1382366424-21010-6-git-send-email-sanimir.agovic@intel.com> In-Reply-To: <1382366424-21010-1-git-send-email-sanimir.agovic@intel.com> References: <1382366424-21010-1-git-send-email-sanimir.agovic@intel.com> X-IsSubscribed: yes X-SW-Source: 2013-10/txt/msg00625.txt.bz2 C99 requires the sizeof operator to be evaluated at runtime to compute the size of the vla, reflect this behavior in gdb. 1| void foo (size_t n, int vla[n][n]) { 2| } (gdb) p sizeof(vla[0]) yields N. 2013-10-18 Sanimir Agovic Keven Boell * eval.c (evaluate_subexp_for_sizeof): Allow side effects for argument to sizeof. Change-Id: I945e8a259e850cc0470faa742a0d2191122ef37b --- gdb/eval.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/gdb/eval.c b/gdb/eval.c index ab3cb95..91cc299 100644 --- a/gdb/eval.c +++ b/gdb/eval.c @@ -3055,7 +3055,7 @@ evaluate_subexp_for_sizeof (struct expression *exp, int *pos) value_from_longest (size_type, (LONGEST) TYPE_LENGTH (type)); default: - val = evaluate_subexp (NULL_TYPE, exp, pos, EVAL_AVOID_SIDE_EFFECTS); + val = evaluate_subexp (NULL_TYPE, exp, pos, EVAL_NORMAL); return value_from_longest (size_type, (LONGEST) TYPE_LENGTH (value_type (val))); } -- 1.7.0.7