From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11395 invoked by alias); 15 Jan 2015 18:07:19 -0000 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 Received: (qmail 11342 invoked by uid 48); 15 Jan 2015 18:07:14 -0000 From: "jlebon at redhat dot com" To: systemtap@sourceware.org Subject: [Bug translator/17749] stap doesn't recognize "++" as a use Date: Thu, 15 Jan 2015 18:07:00 -0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: systemtap X-Bugzilla-Component: translator X-Bugzilla-Version: unspecified X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: jlebon at redhat dot com X-Bugzilla-Status: NEW X-Bugzilla-Priority: P2 X-Bugzilla-Assigned-To: systemtap at sourceware dot org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: cc attachments.created Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: 7bit X-Bugzilla-URL: http://sourceware.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 X-SW-Source: 2015-q1/txt/msg00027.txt.bz2 https://sourceware.org/bugzilla/show_bug.cgi?id=17749 Jonathan Lebon changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jlebon at redhat dot com --- Comment #2 from Jonathan Lebon --- Created attachment 8066 --> https://sourceware.org/bugzilla/attachment.cgi?id=8066&action=edit Possible patch It seems like the issue is that the varuse_collecting_visitor treats the following two as equivalent: a++ ... if (a++) ... I.e. when 'a++' is visited, it doesn't matter whether it's part of an if statement or not. In both cases, the 'a' referent is simply added to the 'read' and 'write' sets but NOT to the 'used' set, causing it to get printed. (The 'used' set contains the vars that are read while not in a rmw context -- this distinction is necessary because a rmw operation is both a read and a write, so the rule for global var printing can't just be "all vars written to but never read" otherwise expr_statements like 'a++' would not trigger auto printing). Note BTW that this is also an issue with for/while loop conditionals. The following patch provides a potential fix for this issue. It overrides the if/for visit methods so that their conditionals are visited as if they were lvalues (and thus cause the symbols to be added to the 'used' set). This technique is already used for visit_print_format() and visit_delete_statement() (see also commit d20a83f8). I have yet to do a full test run with the patch above, but at the very least global_end.exp passes. Also thinking about how to clean up this part of the code to be more explicit. -- You are receiving this mail because: You are the assignee for the bug.