From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6612 invoked by alias); 14 Jun 2007 15:49:23 -0000 Received: (qmail 6603 invoked by uid 22791); 14 Jun 2007 15:49:22 -0000 X-Spam-Status: No, hits=-1.4 required=5.0 tests=AWL,BAYES_20,DK_POLICY_SIGNSOME X-Spam-Check-By: sourceware.org Received: from mga02.intel.com (HELO mga02.intel.com) (134.134.136.20) by sourceware.org (qpsmtpd/0.31) with ESMTP; Thu, 14 Jun 2007 15:49:20 +0000 Received: from orsmga001.jf.intel.com ([10.7.209.18]) by orsmga101.jf.intel.com with ESMTP; 14 Jun 2007 08:49:17 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.16,421,1175497200"; d="scan'208";a="254454491" Received: from jistone-mobl.amr.corp.intel.com (HELO [172.25.115.37]) ([172.25.115.37]) by orsmga001.jf.intel.com with ESMTP; 14 Jun 2007 08:49:17 -0700 Message-ID: <4671637C.8000501@intel.com> Date: Thu, 14 Jun 2007 15:49:00 -0000 From: "Stone, Joshua I" User-Agent: Thunderbird 2.0.0.0 (Windows/20070326) MIME-Version: 1.0 To: Mike Mason CC: systemtap@sources.redhat.com, Eugene Teo Subject: Re: Chained numeric assignments References: <46715527.9080902@us.ibm.com> In-Reply-To: <46715527.9080902@us.ibm.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-IsSubscribed: yes Mailing-List: contact systemtap-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: systemtap-owner@sourceware.org X-SW-Source: 2007-q2/txt/msg00584.txt.bz2 Mike Mason wrote: > Should the following chained assignment: > writes[execname()] = total_io[execname()] += $return > be equivalent to: > writes[execname()] += $return total_io[execname()] += $return Not if we mimic C's operator associativity, which is right-to-left for assignment operators. So your statement is effectively: writes[execname()] = ( total_io[execname()] += $return ) Or equivalent to: total_io[execname()] += $return writes[execname()] = total_io[execname()] Also, if you look at the -p1 output, it will show you the explicit associativity that was parsed. e.g. $ stap -ue 'probe begin { a = b += c }' -p1 # parse tree dump # file probe begin{ (a) = ((b) += (c)) } > They yield different results in a couple scripts I tried (see below). > For example, it appears that writes[] gets assigned total_io[] instead > of += $return. That's correct. But if you're seeing inconsistent results, please file a bug and commit a testcase. Josh